tcp

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2021 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OPEN  = "open"
	CLOSE = "close"
	ERROR = "error"
	START = "start"
	STOP  = "stop"
)
View Source
const (
	HOSTPORT = "hostport"
	HOSTNAME = "hostname"
	PROTOCOL = "protocol"

	LOCALHOST = "localhost"

	HARD = "hard"
	MASK = "mask"
	IP   = "ip"
)
View Source
const (
	RANDOM  = "random"
	CURRENT = "current"
	BEGIN   = "begin"
	END     = "end"
)
View Source
const CLIENT = "client"
View Source
const (
	DIAL = "dial"
)
View Source
const HOST = "host"
View Source
const (
	LISTEN = "listen"
)
View Source
const PORT = "port"
View Source
const SERVER = "server"
View Source
const TCP = "tcp"

Variables

View Source
var Index = &ice.Context{Name: TCP, Help: "通信模块",
	Commands: map[string]*ice.Command{
		ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			m.Load()
			m.Cmd(HOST).Table(func(index int, value map[string]string, head []string) {
				m.Cmd(HOST, aaa.WHITE, value[IP])
			})
		}},
		ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			m.Richs(CLIENT, "", kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
				kit.Value(value, kit.Keym(kit.MDB_STATUS), CLOSE)
			})
			m.Richs(SERVER, "", kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
				kit.Value(value, kit.Keym(kit.MDB_STATUS), CLOSE)
			})
			m.Save(PORT)
		}},
	},
}

Functions

func IsLocalHost added in v0.2.9

func IsLocalHost(m *ice.Message, ip string) bool

func ReplaceLocalhost added in v0.3.8

func ReplaceLocalhost(m *ice.Message, url string) string

Types

type Conn added in v0.2.9

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close added in v0.2.9

func (c *Conn) Close() error

func (*Conn) Read added in v0.2.9

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) Write added in v0.2.9

func (c *Conn) Write(b []byte) (int, error)

type Listener added in v0.2.9

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

func (Listener) Accept added in v0.2.9

func (l Listener) Accept() (net.Conn, error)

func (Listener) Close added in v0.2.9

func (l Listener) Close() error

type Stat added in v0.2.9

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

Jump to

Keyboard shortcuts

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