net

package module
Version: v0.0.0-...-fd5dbc3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 5 Imported by: 0

README

go-net

net tool structs for Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIPOfConnRemote

func GetIPOfConnRemote(conn net.Conn) string

GetIPOfConnRemote 获取Conn的远端IP

func IsPrivateIPv4

func IsPrivateIPv4(ip string) bool

IsPrivateIPv4 检查是否是保留IPv4地址

func ResolvIPv4

func ResolvIPv4(domain string) (ip string, err error)

ResolvIPv4 本地解析IPv4

func ResolvIPv6

func ResolvIPv6(domain string) (ip string, err error)

ResolvIPv6 本地解析IPv6

Types

type AddrType

type AddrType int

AddrType 地址的类型

const (
	InvalidAddr AddrType = iota
	DomainAddr
	IPv4Addr
	IPv6Addr
)

地址类型

func TypeOfAddr

func TypeOfAddr(host string) AddrType

TypeOfAddr 地址的类型

type Arg

type Arg struct {
	Msg       []byte         // 消息
	Host      string         // 主机地址:端口
	Tunnel    *tunnel.Tunnel // 数据隧道
	TheType   int            // 业务类型
	Delegates []func() bool  // 委托队列
}

Arg 网络业务会用到的参数集

type OpType

type OpType int

OpType 网络操作的类型

const (
	ERROR OpType = iota
	CONNECT
	BIND
	UDP
)

网络操作类型

type ResultOfNetOp

type ResultOfNetOp int

ResultOfNetOp 网络操作的结果

const (
	FAILED ResultOfNetOp = iota
	SUCCESS
)

网络操作是否成功

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL