tunat

package module
v0.0.0-...-efc1912 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 10 Imported by: 0

README

tunat

golang tun nat

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tunat

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

Tunat main struct

func New

func New(name string,
	ipv4Prefix,
	ipv6Prefix netip.Prefix,
	bufLen int,
	preCommands []string,
	postCommands []string,
) (tunat *Tunat, err error)

New new a Tunat

func NewFromUnixSocket

func NewFromUnixSocket(path string,
	ipv4Prefix,
	ipv6Prefix netip.Prefix,
	bufLen int,
	preCommands []string,
	postCommands []string,
) (tunat *Tunat, err error)

NewFromUnixSocket new a Tunat from unix

func (*Tunat) Accept

func (t *Tunat) Accept() (conn net.Conn, err error)

Accept like net package

func (*Tunat) Close

func (t *Tunat) Close() (err error)

Close close tun device

func (*Tunat) ReadFromUDPAddrPort

func (t *Tunat) ReadFromUDPAddrPort(payload []byte) (nread int, saddr, daddr netip.AddrPort, err error)

ReadFromUDPAddrPort like net package

func (*Tunat) WriteToUDPAddrPort

func (t *Tunat) WriteToUDPAddrPort(payload []byte, saddr, daddr netip.AddrPort) (nwrite int, err error)

WriteToUDPAddrPort like net package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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