proxy

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFreeIp

func GetFreeIp(cidrAddr string, dstPort int) (string, error)

GetFreeIp - gets available free ip from the cidr provided

func GetInterfaceListenAddr

func GetInterfaceListenAddr(port int) (*net.UDPAddr, error)

GetInterfaceListenAddr - gets interface listen addr

func PeerConnectionStatus

func PeerConnectionStatus(peerPublicKey string) bool

PeerConnectionStatus - get peer connection status from wireguard interface

Types

type Proxy

type Proxy struct {
	Ctx        context.Context
	Cancel     context.CancelFunc
	Config     models.Proxy
	RemoteConn *net.UDPAddr
	LocalConn  net.Conn
}

Proxy - struct for wg proxy

func New

func New(config models.Proxy) *Proxy

New - gets new proxy config

func (*Proxy) Close

func (p *Proxy) Close()

Proxy.Close - removes peer conn from proxy and closes all the opened connections locally

func (*Proxy) ProxyPeer

func (p *Proxy) ProxyPeer()

Proxy.ProxyPeer proxies data from Wireguard to the remote peer and vice-versa

func (*Proxy) Reset

func (p *Proxy) Reset()

Proxy.Reset - resets peer's conn

func (*Proxy) Start

func (p *Proxy) Start() error

Proxy.Start - starts proxying the peer

Jump to

Keyboard shortcuts

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