mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-09 05:16:45 +08:00
37 lines
682 B
Go
37 lines
682 B
Go
package proxy
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"github.com/gravitl/netmaker/netclient/netclient-proxy/server"
|
|
"github.com/gravitl/netmaker/netclient/netclient-proxy/wg"
|
|
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
|
)
|
|
|
|
const (
|
|
defaultBodySize = 10000
|
|
defaultPort = 51722
|
|
)
|
|
|
|
type Config struct {
|
|
Port int
|
|
BodySize int
|
|
Addr string
|
|
WgListenAddr string
|
|
RemoteKey string
|
|
WgInterface *wg.WGIface
|
|
AllowedIps []net.IPNet
|
|
PreSharedKey *wgtypes.Key
|
|
ProxyServer *server.ProxyServer
|
|
}
|
|
|
|
// Proxy - WireguardProxy proxies
|
|
type Proxy struct {
|
|
Ctx context.Context
|
|
Cancel context.CancelFunc
|
|
|
|
Config Config
|
|
RemoteConn net.Conn
|
|
LocalConn net.Conn
|
|
}
|