proxy

package
v0.18.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: Apache-2.0 Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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