comm

package
v0.0.0-...-401b346 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 18 Imported by: 6

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 ConnPipe

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

tcp swap

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 GetPortDialer

func GetPortDialer(min int, max int) *net.Dialer

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)

Types

type CachedResponse

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

type CommConn

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

type DnsCacheV1

type DnsCacheV1 struct {
	Cache map[string]CachedResponse
	sync.Mutex
}

func (*DnsCacheV1) Free

func (rd *DnsCacheV1) Free(expired int64)

func (*DnsCacheV1) ReadDnsCache

func (rd *DnsCacheV1) ReadDnsCache(domain string, expired int64) *dns.Msg

func (*DnsCacheV1) WriteDnsCache

func (rd *DnsCacheV1) WriteDnsCache(domain string, msg *dns.Msg) string

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