Documentation ¶
Index ¶
- Constants
- Variables
- func BufioConn() net.Conn
- func CloseRead(conn net.Conn) error
- func CloseWrite(conn net.Conn) error
- func ConnTwoWayCopy(req ConnTwoWayCopyRequest)
- func ErrorMsgIsNetworkIsUnreachable(s string) bool
- func GetIpAndPortFromNetAddr(addri net.Addr) (ip net.IP, port uint16, errMsg string)
- func GetIpStringFromAddrStringIgnoreNotFound(addr string) string
- func GetIpStringFromtNetAddrIgnoreNotExist(addri net.Addr) (s string)
- func GetIpStringNoPortOrInput(addr string) string
- func GetPossiableConnectAddrDebugString(listenAddr string) string
- func GetPossiableConnectAddrStringList(listenAddr string) (outList []string)
- func GetProtocolNotSupportPortError() error
- func GetSocketCloseError() error
- func IPMaskGetOnes(mask net.IPMask) int
- func IPNetGetGenMaskString(ipNet *net.IPNet) (s string)
- func IPNetGetMaxIp(ipnet *net.IPNet) net.IP
- func IPNetGetMinIp(ipnet *net.IPNet) net.IP
- func IPNetGetOnes(ipnet net.IPNet) int
- func IPNetIsZero(ipnet net.IPNet) bool
- func IpClone(a net.IP) net.IP
- func IpGetBit(ip net.IP, index uint8) uint8
- func IpLess(a net.IP, b net.IP) bool
- func IpSetBit(ip net.IP, index uint8, value uint8) net.IP
- func IpSetBit0(ip net.IP, index uint8) net.IP
- func IpSetBit1(ip net.IP, index uint8) net.IP
- func Ipv4AddAndCopyWithBuffer(ip net.IP, toAdd uint32, bufW *udwBytes.BufWriter) net.IP
- func Ipv4GetBit(ip net.IP, index uint8) uint8
- func Ipv4ToUint32OrZero(a net.IP) uint32
- func IsBadFileDescripter(err error) bool
- func IsConnectionRefused(err error) bool
- func IsConnectionRefusedString(errMsg string) bool
- func IsErrorMsgNetwork(errorMsg string) bool
- func IsErrorMsgSocketClose(errMsg string) bool
- func IsInLinkLocalNetwork(ip net.IP) bool
- func IsInLoopBackNetwork(ip net.IP) bool
- func IsInterruptedSystemCall(err error) bool
- func IsIpv6Only() bool
- func IsLocalNetwork(ip net.IP) bool
- func IsMessageTooLong(err error) bool
- func IsNetworkIsUnreachable(err error) bool
- func IsNoBufferSpaceAvailable(err error) bool
- func IsNoRouteToHost(err error) bool
- func IsNoRouteToHostString(errMsg string) bool
- func IsPrivateNetwork(ip net.IP) bool
- func IsResourceBusy(err error) bool
- func IsSocketCloseError(err error) bool
- func IsStringValidIp(sIp string) bool
- func IsTimeoutError(err error) bool
- func IsTimeoutErrorString(errMsg string) bool
- func IsUseOfClosedNetworkConnection(err error) bool
- func IsVpnConnectedIgnorePanic() bool
- func JoinHostPortInt(host string, port int) string
- func JoinHostPortNoAlloc(buf []byte, ip string, port int) []byte
- func LessDelayDial(network string, address string) (conn net.Conn, err error)
- func LessDelayTcpConn(conn *net.TCPConn) (connOut net.Conn, err error)
- func ListenerConnWrapper(l net.Listener, connWrapper ConnWrapper) net.Listener
- func MustGetCurrentIpWithPortList(port uint16) (sList []string)
- func MustGetDefaultGatewayIP() net.IP
- func MustGetDefaultRouteRuleInterfaceFirstIpAddr() net.IP
- func MustGetHostFromAddr(addr string) string
- func MustGetIpFromNetAddr(addri net.Addr) (ip net.IP)
- func MustGetIpList() (ipList []net.IP)
- func MustGetIpListToString() string
- func MustGetLocalAddrFromAddr(addr net.Addr) string
- func MustGetLocalAddrFromListener(listener net.Listener) string
- func MustGetPortFromNetAddr(addri net.Addr) int
- func MustGetPortFromNetAddrIgnoreNotFound(addri net.Addr) int
- func MustGetServerAddrString(s Server) string
- func MustGetServerLocalAddrString(s Server) string
- func MustIpv4Add(ip net.IP, toAdd uint32) net.IP
- func MustIpv4ToUint32(a net.IP) uint32
- func MustIpv4ToWindowsDword(a net.IP) uint32
- func MustIsVpnConnected() bool
- func MustLessDelayListen(network string, address string) net.Listener
- func MustListen(network string, address string) net.Listener
- func MustLookupDomainInAddrString(addr string) string
- func MustParseCIDR(s string) *net.IPNet
- func MustParseIPNet(s string) *net.IPNet
- func MustParseIpStringToInt64(ipStr string) int64
- func MustRouteDeleteWithString(IpNetString string)
- func MustRouteSetWithString(IpNetString string, gatewayString string)
- func MustServerStart(s Server)
- func MustSplitIpPort(addr string) (ip net.IP, port uint16)
- func MustSplitIpPortForListener(addr string) (ip net.IP, port uint16)
- func MustTcpRandomListen() net.Listener
- func NetErrorMsgSimple(errorMsg string) string
- func NewDebugConn(conn net.Conn, name string) net.Conn
- func NewDebugConnNoData(conn net.Conn) net.Conn
- func NewDebugConnNoDataWithName(conn net.Conn, name string) net.Conn
- func NewFixedAddressDialer(parent Dialer, network string, address string) func() (net.Conn, error)
- func NewFixedDialerV2(parent Dialer, network string, address string) func(network, address string) (net.Conn, error)
- func NewRwcOverConn(rwc io.ReadWriteCloser, conn net.Conn) net.Conn
- func NewSizeDebugConn(conn net.Conn, name string) net.Conn
- func NewStringDebugConn(conn net.Conn, name string) net.Conn
- func NewTimeoutDialer(timeout time.Duration) func(network, addr string) (net.Conn, error)
- func ParseGenmask(genMask string) (mask net.IPMask, err error)
- func ParseIpToBuf(s string, buf []byte) (ip net.IP)
- func ParseIpv4ToUint32(s string) (b uint32, ok bool)
- func PortFromAddrString(addr string) (int, error)
- func PortFromNetAddr(addr net.Addr) (int, error)
- func RouteTableDebugPrint()
- func RouteTableDebugPrintToWriter(w io.Writer)
- func RunTCPServerListenAddr(listenAddr string, handle ConnHandlerFunc) (closer func() error)
- func RunTCPServerV2(Listener net.Listener, handle ConnHandlerFunc) (closer func() error)
- func RwcConn(rwc io.ReadWriteCloser) net.Conn
- func RwcConnWithSetDeadline(rwc io.ReadWriteCloser, setDeadline func(t time.Time) error) net.Conn
- func SetMockedListen(f func(network, address string) (net.Listener, error))
- func SplitIpPort(addr string) (ip net.IP, port uint16, err error)
- func TcpNewListener(listenAddr string, processor func(conn net.Conn)) (closer func())
- func TcpNewListenerFromExistListener(listener net.Listener, processor func(conn net.Conn)) (closer func())
- func TimeoutConn(conn net.Conn, timeout time.Duration) net.Conn
- func TproxyListenerPortWorkAround(addr string) []string
- func TransferIpv4StringToSupportIpv6Only(ipS string) string
- func Uint32ToIpv4(u uint32) net.IP
- type ConnHandler
- type ConnHandlerFunc
- type ConnServer
- type ConnTwoWayCopyRequest
- type ConnWrapper
- type Dialer
- type DirectDialer
- type DirectDialerFunc
- type FixedAddressDialer
- type FuncServer
- type GetUnderlyingConner
- type NetDevice
- func (i *NetDevice) CanConnect() bool
- func (i *NetDevice) GetFirstIpv4IP() net.IP
- func (i *NetDevice) GetIndex() int
- func (i *NetDevice) GetIpList() []net.IP
- func (i *NetDevice) GetName() string
- func (i *NetDevice) GetNonLinkLocalIpList() []net.IP
- func (i *NetDevice) HasIpv4Addr() bool
- func (i *NetDevice) IsPointToPoint() bool
- func (i *NetDevice) IsUp() bool
- func (i *NetDevice) String() string
- type NewDialer
- type NewDialerResponse
- type NewListener
- type RouteContext
- func (ctx RouteContext) MustGetDefaultRouteRule() (rule *RouteRuleV2)
- func (ctx RouteContext) MustGetRouteTable() (ruleList []*RouteRuleV2)
- func (ctx RouteContext) MustRouteDelete(ipNet net.IPNet)
- func (ctx RouteContext) MustRouteDeleteWithString(IpNetString string)
- func (ctx RouteContext) MustRouteSet(ipNet net.IPNet, gateWayIp net.IP)
- func (ctx RouteContext) MustRouteSetWithString(IpNetString string, gatewayString string)
- type RouteRuleV2
- type RwcDialer
- type RwcDialerFunc
- type RwcOverConn
- type Server
- type TcpListener
- type TunImp
- type UdpListener
- type UdpReadContext
- type WrapDialTimeoutReq
- type WrapTcpDialRequest
Constants ¶
View Source
const ErrMsgSocketCloseError = "use of closed network connection"
Variables ¶
View Source
var FakeAddr = fakeAddr{}
Functions ¶
func CloseWrite ¶
func ConnTwoWayCopy ¶
func ConnTwoWayCopy(req ConnTwoWayCopyRequest)
func GetIpAndPortFromNetAddr ¶
func GetProtocolNotSupportPortError ¶
func GetProtocolNotSupportPortError() error
func GetSocketCloseError ¶
func GetSocketCloseError() error
func IPMaskGetOnes ¶
func IPNetGetGenMaskString ¶
func IPNetGetOnes ¶
func IPNetIsZero ¶
func Ipv4ToUint32OrZero ¶
func IsBadFileDescripter ¶
func IsConnectionRefused ¶
func IsErrorMsgNetwork ¶
func IsErrorMsgSocketClose ¶
func IsInLinkLocalNetwork ¶
func IsInLoopBackNetwork ¶
func IsInterruptedSystemCall ¶
func IsIpv6Only ¶
func IsIpv6Only() bool
func IsLocalNetwork ¶
func IsMessageTooLong ¶
func IsNetworkIsUnreachable ¶
func IsNoRouteToHost ¶
func IsNoRouteToHostString ¶
func IsPrivateNetwork ¶
func IsResourceBusy ¶
func IsSocketCloseError ¶
func IsStringValidIp ¶
func IsTimeoutError ¶
func IsTimeoutErrorString ¶
func IsVpnConnectedIgnorePanic ¶
func IsVpnConnectedIgnorePanic() bool
func JoinHostPortInt ¶
func ListenerConnWrapper ¶
func ListenerConnWrapper(l net.Listener, connWrapper ConnWrapper) net.Listener
func MustGetDefaultGatewayIP ¶
func MustGetHostFromAddr ¶
func MustGetIpList ¶
func MustGetIpListToString ¶
func MustGetIpListToString() string
func MustGetPortFromNetAddr ¶
func MustGetServerAddrString ¶
func MustIpv4ToUint32 ¶
func MustIpv4ToWindowsDword ¶
func MustIsVpnConnected ¶
func MustIsVpnConnected() bool
func MustParseCIDR ¶
func MustParseIPNet ¶
func MustRouteDeleteWithString ¶
func MustRouteDeleteWithString(IpNetString string)
func MustRouteSetWithString ¶
func MustServerStart ¶
func MustServerStart(s Server)
func MustTcpRandomListen ¶
func NetErrorMsgSimple ¶
func NewFixedAddressDialer ¶
func NewFixedDialerV2 ¶
func NewRwcOverConn ¶
func NewTimeoutDialer ¶
func ParseIpv4ToUint32 ¶
func PortFromAddrString ¶
func RouteTableDebugPrint ¶
func RouteTableDebugPrint()
func RunTCPServerListenAddr ¶
func RunTCPServerListenAddr(listenAddr string, handle ConnHandlerFunc) (closer func() error)
func RunTCPServerV2 ¶
func RunTCPServerV2(Listener net.Listener, handle ConnHandlerFunc) (closer func() error)
func RwcConnWithSetDeadline ¶
func TcpNewListener ¶
func Uint32ToIpv4 ¶
Types ¶
type ConnHandler ¶
type ConnHandlerFunc ¶
func (ConnHandlerFunc) ConnHandle ¶
func (f ConnHandlerFunc) ConnHandle(conn net.Conn)
type ConnServer ¶
type ConnServer struct { Listener net.Listener Handler ConnHandler Closer io.Closer }
func NewTCPServer ¶
func NewTCPServer(listenAddr string, hander ConnHandler, closer io.Closer) (s *ConnServer, err error)
func (*ConnServer) Close ¶
func (server *ConnServer) Close() (err error)
func (*ConnServer) Start ¶
func (server *ConnServer) Start() (err error)
type ConnTwoWayCopyRequest ¶
type Dialer ¶
func NewDebugDialerNoData ¶
func NewRetractableNetDial ¶
func WrapDialTimeout ¶
func WrapDialTimeout(req WrapDialTimeoutReq) Dialer
func WrapTcpDial ¶
func WrapTcpDial(req WrapTcpDialRequest) Dialer
type DirectDialer ¶
type DirectDialerFunc ¶
type FixedAddressDialer ¶
type FuncServer ¶
type FuncServer struct { StartFunc func() error CloseFunc func() error AddrFunc func() (net.Addr, error) ExistAddr net.Addr }
func (*FuncServer) Close ¶
func (s *FuncServer) Close() error
func (*FuncServer) Start ¶
func (s *FuncServer) Start() error
type GetUnderlyingConner ¶
type NetDevice ¶
type NetDevice struct {
// contains filtered or unexported fields
}
func GetNetDeviceByIndex ¶
func GetNetDeviceByName ¶
func GetNetDeviceList ¶
func MustGetNetDeviceList ¶
func MustGetNetDeviceList() []*NetDevice
func (*NetDevice) CanConnect ¶
func (*NetDevice) GetFirstIpv4IP ¶
func (*NetDevice) GetNonLinkLocalIpList ¶
func (*NetDevice) HasIpv4Addr ¶
func (*NetDevice) IsPointToPoint ¶
type NewDialer ¶
type NewDialer func() (response NewDialerResponse)
type NewDialerResponse ¶
type NewDialerResponse struct { Dialer Dialer Closer func() }
func TcpNewDialer ¶
func TcpNewDialer() (response NewDialerResponse)
type NewListener ¶
type RouteContext ¶
type RouteContext struct {
// contains filtered or unexported fields
}
func NewRouteContext ¶
func NewRouteContext() RouteContext
func (RouteContext) MustGetDefaultRouteRule ¶
func (ctx RouteContext) MustGetDefaultRouteRule() (rule *RouteRuleV2)
func (RouteContext) MustGetRouteTable ¶
func (ctx RouteContext) MustGetRouteTable() (ruleList []*RouteRuleV2)
func (RouteContext) MustRouteDelete ¶
func (ctx RouteContext) MustRouteDelete(ipNet net.IPNet)
func (RouteContext) MustRouteDeleteWithString ¶
func (ctx RouteContext) MustRouteDeleteWithString(IpNetString string)
func (RouteContext) MustRouteSet ¶
func (ctx RouteContext) MustRouteSet(ipNet net.IPNet, gateWayIp net.IP)
func (RouteContext) MustRouteSetWithString ¶
func (ctx RouteContext) MustRouteSetWithString(IpNetString string, gatewayString string)
type RouteRuleV2 ¶
type RouteRuleV2 struct {
// contains filtered or unexported fields
}
func MustGetDefaultRouteRule ¶
func MustGetDefaultRouteRule() (rule *RouteRuleV2)
func MustGetRouteTable ¶
func MustGetRouteTable() (ruleList []*RouteRuleV2)
func (*RouteRuleV2) GetDstIpNet ¶
func (rule *RouteRuleV2) GetDstIpNet() net.IPNet
func (*RouteRuleV2) GetGatewayIp ¶
func (rule *RouteRuleV2) GetGatewayIp() net.IP
func (*RouteRuleV2) GetOutInterface ¶
func (rule *RouteRuleV2) GetOutInterface() *NetDevice
func (*RouteRuleV2) IsIpv4 ¶
func (rule *RouteRuleV2) IsIpv4() bool
func (*RouteRuleV2) String ¶
func (rule *RouteRuleV2) String() string
type RwcDialer ¶
type RwcDialer interface {
RwcDial(addr string) (rwc io.ReadWriteCloser, err error)
}
type RwcDialerFunc ¶
type RwcDialerFunc func(addr string) (rwc io.ReadWriteCloser, err error)
func (RwcDialerFunc) RwcDial ¶
func (f RwcDialerFunc) RwcDial(addr string) (rwc io.ReadWriteCloser, err error)
type RwcOverConn ¶
func (*RwcOverConn) Close ¶
func (c *RwcOverConn) Close() (err error)
func (*RwcOverConn) GetUnderlyingConn ¶
func (c *RwcOverConn) GetUnderlyingConn() net.Conn
type TcpListener ¶
type TcpListener struct {
// contains filtered or unexported fields
}
func TcpNewListenerReturnListener ¶
func TcpNewListenerReturnListener(listenAddr string, processor func(conn net.Conn)) (tl *TcpListener)
func (*TcpListener) Close ¶
func (tl *TcpListener) Close()
func (*TcpListener) GetListenPort ¶
func (tl *TcpListener) GetListenPort() int
type TunImp ¶
type TunImp struct { NewDialer func() (response NewDialerResponse) NewListener func(listenAddr string, processor func(conn net.Conn)) (Closer func()) }
type UdpListener ¶
type UdpListener struct {
// contains filtered or unexported fields
}
func MustRunUdpListener ¶
func MustRunUdpListener(listenAddr string, processor func(ctx UdpReadContext)) *UdpListener
func (*UdpListener) Close ¶
func (l *UdpListener) Close()
func (*UdpListener) GetListenConn ¶
func (l *UdpListener) GetListenConn() *net.UDPConn
func (*UdpListener) GetListenPort ¶
func (l *UdpListener) GetListenPort() int
func (*UdpListener) IsClose ¶
func (l *UdpListener) IsClose() bool
type UdpReadContext ¶
type WrapDialTimeoutReq ¶
Source Files ¶
- BufioConn.go
- ConnServer_@Deprecated.go
- DirectDialer.go
- IP.go
- IPNet.go
- IpParse.go
- IsVpnConnected.go
- LessDelayTcpConn_linux.go
- ListenerConnWrapper.go
- RwcConn.go
- Server.go
- TimeoutConn.go
- TproxyListenerPortList_linux.go
- TwoWayCopy.go
- UdpListener.go
- addr.go
- debugConn.go
- deprecated.go
- dns.go
- error.go
- interface.go
- ipv6.go
- ipv6_other.go
- listenAddr.go
- netDevice.go
- netDevice_other.go
- port.go
- route.go
- route_linux.go
- tcpListener.go
- timeoutDial.go
- tunnel.go
- udwNet.go
Click to show internal directories.
Click to hide internal directories.