overlay

package
v0.0.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMTU = 1400
)

Variables

This section is empty.

Functions

func StringToCIDRs

func StringToCIDRs(str []string) ([]*net.IPNet, error)

Types

type ClientConn

type ClientConn struct {
	Conn
}

func NewClientConn

func NewClientConn(
	name string,
	clientIP net.IP,
	serverRoutes []*net.IPNet,
	serverAddr string,
) (*ClientConn, error)

func (*ClientConn) SetProxyAddr

func (c *ClientConn) SetProxyAddr(addr string) error

type Conn

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

func (*Conn) Run

func (c *Conn) Run(ctx context.Context)

func (*Conn) SetRxFunc

func (c *Conn) SetRxFunc(f func())

func (*Conn) SetTxFunc

func (c *Conn) SetTxFunc(f func())

type Route

type Route struct {
	MTU    int
	Metric int
	Cidr   *net.IPNet
	Via    *iputil.VpnIp
}

type ServerConn

type ServerConn struct {
	Conn
	// contains filtered or unexported fields
}

func NewServerConn

func NewServerConn(
	name string,
	serverIP net.IP,
	listenPort int,
	clientRoutes []*net.IPNet,
) (*ServerConn, error)

func (*ServerConn) SetListenPort

func (s *ServerConn) SetListenPort(port int) error

type Tun

type Tun struct {
	io.ReadWriteCloser

	Device string

	MaxMTU     int
	DefaultMTU int
	TXQueueLen int
	Routes     []Route
	// contains filtered or unexported fields
}

func NewTun

func NewTun(l *logrus.Logger,
	deviceName string,
	cidr *net.IPNet,
	defaultMTU int,
	routes []Route,
	txQueueLen int,
	multiqueue bool,
) (*Tun, error)

func (Tun) Activate

func (t Tun) Activate() error

func (*Tun) Cidr

func (t *Tun) Cidr() *net.IPNet

func (*Tun) Name

func (t *Tun) Name() string

func (*Tun) NewMultiQueueReader

func (t *Tun) NewMultiQueueReader() (io.ReadWriteCloser, error)

func (*Tun) RouteFor

func (t *Tun) RouteFor(ip iputil.VpnIp) iputil.VpnIp

func (*Tun) Write

func (t *Tun) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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