proxy

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 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 DirectNoProxy added in v0.16.0

type DirectNoProxy 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
}

DirectNoProxy 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) DirectNoProxy will just update remote peer with a remote host and fixed WireGuard port (r.g. 51820). In order DirectNoProxy to work, WireGuard port has to be fixed for the time being.

func NewDirectNoProxy added in v0.16.0

func NewDirectNoProxy(config Config, remoteWgPort int) *DirectNoProxy

NewDirectNoProxy creates a new DirectNoProxy with a provided config and remote peer's WireGuard listen port

func (*DirectNoProxy) Close added in v0.16.0

func (p *DirectNoProxy) Close() error

Close removes peer from the WireGuard interface

func (*DirectNoProxy) Start added in v0.16.0

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

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

func (*DirectNoProxy) Type added in v0.16.0

func (p *DirectNoProxy) Type() Type

Type returns the type of this proxy

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 {
	// contains filtered or unexported fields
}

NoProxy is used just to configure WireGuard without any local proxy in between. Used when the WireGuard interface is userspace and uses bind.ICEBind

func NewNoProxy

func NewNoProxy(config Config) *NoProxy

NewNoProxy creates a new NoProxy with a provided config

func (*NoProxy) Close

func (p *NoProxy) Close() error

Close removes peer from the WireGuard interface

func (*NoProxy) Start

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

Start just updates WireGuard peer with the remote address

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 (
	TypeDirectNoProxy Type = "DirectNoProxy"
	TypeWireGuard     Type = "WireGuard"
	TypeDummy         Type = "Dummy"
	TypeNoProxy       Type = "NoProxy"
)

type WireGuardProxy added in v0.16.0

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

WireGuardProxy proxies

func NewWireGuardProxy added in v0.16.0

func NewWireGuardProxy(config Config) *WireGuardProxy

func (*WireGuardProxy) Close added in v0.16.0

func (p *WireGuardProxy) Close() error

func (*WireGuardProxy) Start added in v0.16.0

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

func (*WireGuardProxy) Type added in v0.16.0

func (p *WireGuardProxy) Type() Type

Jump to

Keyboard shortcuts

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