proxy

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultWgKeepAlive = 25 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	WgListenAddr string
	RemoteKey    string
	WgInterface  *iface.WGIface
	AllowedIps   string
	PreSharedKey *wgtypes.Key
}

type DummyProxy

type DummyProxy struct {
	// contains filtered or unexported fields
}

DummyProxy just sends pings to the RemoteKey peer and reads responses

func NewDummyProxy

func NewDummyProxy(remote string) *DummyProxy

func (*DummyProxy) Close

func (p *DummyProxy) Close() error

func (*DummyProxy) Start

func (p *DummyProxy) Start(remoteConn net.Conn) error

func (*DummyProxy) Type

func (p *DummyProxy) Type() Type

type NoProxy

type NoProxy struct {

	// RemoteWgListenPort is a WireGuard port of a remote peer.
	// It is used instead of the hardcoded 51820 port.
	RemoteWgListenPort int
	// contains filtered or unexported fields
}

NoProxy is used when there is no need for a proxy between ICE and Wireguard. This is possible in either of these cases: - peers are in the same local network - one of the peers has a public static IP (host) NoProxy will just update remote peer with a remote host and fixed Wireguard port (r.g. 51820). In order NoProxy to work, Wireguard port has to be fixed for the time being.

func NewNoProxy

func NewNoProxy(config Config, remoteWgPort int) *NoProxy

NewNoProxy creates a new NoProxy with a provided config and remote peer's WireGuard listen port

func (*NoProxy) Close

func (p *NoProxy) Close() error

func (*NoProxy) Start

func (p *NoProxy) Start(remoteConn net.Conn) error

Start just updates Wireguard peer with the remote IP and default Wireguard port

func (*NoProxy) Type

func (p *NoProxy) Type() Type

type Proxy

type Proxy interface {
	io.Closer
	// Start creates a local remoteConn and starts proxying data from/to remoteConn
	Start(remoteConn net.Conn) error
	Type() Type
}

type Type

type Type string
const (
	TypeNoProxy   Type = "NoProxy"
	TypeWireguard Type = "Wireguard"
	TypeDummy     Type = "Dummy"
)

type WireguardProxy

type WireguardProxy struct {
	// contains filtered or unexported fields
}

WireguardProxy proxies

func NewWireguardProxy

func NewWireguardProxy(config Config) *WireguardProxy

func (*WireguardProxy) Close

func (p *WireguardProxy) Close() error

func (*WireguardProxy) Start

func (p *WireguardProxy) Start(remoteConn net.Conn) error

func (*WireguardProxy) Type

func (p *WireguardProxy) Type() Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL