network

package
v0.0.0-...-9d436b2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 5 Imported by: 0

README

Most files in this directory are copied from https://github.com/yinghuocho/gotun2socks, with slightly modifies.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Icmp4PacketPool = &sync.Pool{
		New: func() interface{} {
			return &Icmp4Packet{}
		},
	}
)
View Source
var MTU int = 1500

Functions

func GenFragments

func GenFragments(first *packet.IPv4, offset uint16, data []byte) []*ipPacket

Types

type Icmp4Packet

type Icmp4Packet struct {
	Ip     *packet.IPv4
	Icmp4  *packet.ICMPv4
	MtuBuf []byte
	Wire   []byte
}

func ResponseICMPv4Packet

func ResponseICMPv4Packet(local net.IP, remote net.IP, Type uint8, Code uint8, respPayload []byte) *Icmp4Packet

type TunHandler

type TunHandler struct {
	WriteCh chan interface{}
	// contains filtered or unexported fields
}

func New

func New(dev io.ReadWriteCloser, mtu int, handler func([]byte, *packet.IPv4) error) *TunHandler

func (*TunHandler) Run

func (th *TunHandler) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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