Support no-proxy mode connection mode (#245)

When one of the peers has a static public host IP
or both peers are in the same local network
we establish a direct Wireguard connection
bypassing proxy usage.
This helps reduce FD usage and improves
performance.
This commit is contained in:
Mikhail Bragin
2022-03-01 14:07:33 +01:00
committed by GitHub
parent 69cda73bbb
commit 5d4c2643a3
8 changed files with 129 additions and 6 deletions

View File

@@ -10,6 +10,14 @@ import (
const DefaultWgKeepAlive = 25 * time.Second
type Type string
const (
TypeNoProxy Type = "NoProxy"
TypeWireguard Type = "Wireguard"
TypeDummy Type = "Dummy"
)
type Config struct {
WgListenAddr string
RemoteKey string
@@ -22,4 +30,5 @@ type Proxy interface {
io.Closer
// Start creates a local remoteConn and starts proxying data from/to remoteConn
Start(remoteConn net.Conn) error
Type() Type
}