comm

package
v0.0.0-...-159e71c Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRoute

func AddRoute(tunAddr string, tunGw string, tunMask string) error

func CmdHide

func CmdHide(name string, arg ...string) *exec.Cmd

func GetCidrRandIp

func GetCidrRandIp(cidr string) string

func GetCidrRandIpByNet

func GetCidrRandIpByNet(tunAddr string, tunMask string) string

根据子网掩码返回一个IP段

func GetDnsServer

func GetDnsServer() []string

func GetLocalAddresses

func GetLocalAddresses() ([]lAddr, error)

func GetLocalIpV4

func GetLocalIpV4() string

func GetNetworkInfo

func GetNetworkInfo() ([]lAddr, error)

func GetUnusedTunAddr

func GetUnusedTunAddr() (string, string)

get Unused B return tunaddr tungw

func GetUseDns

func GetUseDns(dnsAddr string, tunGW string, _tunGW string) string

获取旧的dns,内网解析用

func GetWaterConf

func GetWaterConf(tunAddr string, tunMask string) water.Config

func IntnRange

func IntnRange(min, max int) int

func IsChinaMainlandIP

func IsChinaMainlandIP(IP string) bool

func IsPublicIP

func IsPublicIP(ip net.IP) bool

func ResetNetConf

func ResetNetConf(ip string)

func SetNetConf

func SetNetConf(dnsIpv4 string, dnsIpv6 string)

func TcpPipe

func TcpPipe(src CommConn, dst CommConn, duration time.Duration)

tcp swap

func TunNatSawp

func TunNatSawp(_udpNat *sync.Map, conn core.CommUDPConn, ep core.CommEndpoint, dstAddr string, duration time.Duration)

udp nat sawp

Types

type CommConn

type CommConn interface {
	SetDeadline(t time.Time) error
	io.ReadWriteCloser
}

type DnsCache

type DnsCache struct {
	Cache map[string]IpInfo
	sync.Mutex
}

func (*DnsCache) Free

func (rd *DnsCache) Free()

func (*DnsCache) ReadDnsCache

func (rd *DnsCache) ReadDnsCache(remoteHost string) (string, uint32)

func (*DnsCache) WriteDnsCache

func (rd *DnsCache) WriteDnsCache(remoteHost string, ttl uint32, ip string) string

type IpInfo

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

type TimeoutConn

type TimeoutConn struct {
	Conn    CommConn
	TimeOut time.Duration
}

func (TimeoutConn) Read

func (conn TimeoutConn) Read(buf []byte) (int, error)

func (TimeoutConn) Write

func (conn TimeoutConn) Write(buf []byte) (int, error)

type UdpLimit

type UdpLimit struct {
	Limit   *rate.Limiter
	Expired int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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