proxy.go 682 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package proxy
  2. import (
  3. "context"
  4. "net"
  5. "github.com/gravitl/netmaker/netclient/netclient-proxy/server"
  6. "github.com/gravitl/netmaker/netclient/netclient-proxy/wg"
  7. "golang.zx2c4.com/wireguard/wgctrl/wgtypes"
  8. )
  9. const (
  10. defaultBodySize = 10000
  11. defaultPort = 51722
  12. )
  13. type Config struct {
  14. Port int
  15. BodySize int
  16. Addr string
  17. WgListenAddr string
  18. RemoteKey string
  19. WgInterface *wg.WGIface
  20. AllowedIps []net.IPNet
  21. PreSharedKey *wgtypes.Key
  22. ProxyServer *server.ProxyServer
  23. }
  24. // Proxy - WireguardProxy proxies
  25. type Proxy struct {
  26. Ctx context.Context
  27. Cancel context.CancelFunc
  28. Config Config
  29. RemoteConn net.Conn
  30. LocalConn net.Conn
  31. }