tcp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 10 Imported by: 17

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

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

func ReplaceLocalhost

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

Types

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Read

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

func (*Conn) Write

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

type Listener

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

func (Listener) Accept

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

func (Listener) Close

func (l Listener) Close() error

type Stat

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