network

package
v0.0.0-...-6bd00d5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PacketMaxCap int = 1 << 20
	PacketMinCap int = 1 << 10
)

Variables

View Source
var (
	MsgType = 2
)

Functions

func NewTcpAgent

func NewTcpAgent(addr string, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) *tcpAgent

NewTcpAgent receiver接收字节如果使用异步方式需要copy一份,否则数据会被覆盖

func NewTcpDialer

func NewTcpDialer(name, addr string, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) kiwi.IDialer

func NewTcpListener

func NewTcpListener(addr string, onConn func(conn net.Conn)) kiwi.IListener

func NewUdpAgent

func NewUdpAgent(addr string, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) *udpAgent

func NewUdpDialer

func NewUdpDialer(name, addr string, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) kiwi.IDialer

func NewUdpListener

func NewUdpListener(addr string, onConn func(conn net.Conn)) kiwi.IListener

func NewWebAgent

func NewWebAgent(addr string, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) *webAgent

func NewWebDialer

func NewWebDialer(name, url string, header http.Header, receiver kiwi.FnAgentBytes, options ...kiwi.AgentOption) kiwi.IDialer

func NewWebListener

func NewWebListener(addr string, onConn func(conn *websocket.Conn), opt *kiwi.GateWsOption) kiwi.IListener

Types

type HttpAgent

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

func NewHttpAgent

func NewHttpAgent(addr string, opts ...kiwi.AgentOption) *HttpAgent

func (HttpAgent) Addr

func (a HttpAgent) Addr() string

func (*HttpAgent) BindConnected

func (a *HttpAgent) BindConnected(fn kiwi.FnAgent)

func (*HttpAgent) BindDisconnected

func (a *HttpAgent) BindDisconnected(fn kiwi.FnAgentErr)

func (HttpAgent) ClearSession

func (a HttpAgent) ClearSession()

func (HttpAgent) CopySession

func (a HttpAgent) CopySession(m util.M)

func (HttpAgent) DelSession

func (a HttpAgent) DelSession(keys []string, updated util.M)

func (HttpAgent) EConn

func (a HttpAgent) EConn() kiwi.EConn

func (HttpAgent) GetSession

func (a HttpAgent) GetSession(key string) (val any, exist bool)

func (HttpAgent) Host

func (a HttpAgent) Host() string

func (HttpAgent) Id

func (a HttpAgent) Id() string

func (HttpAgent) SetId

func (a HttpAgent) SetId(id string)

func (HttpAgent) SetSession

func (a HttpAgent) SetSession(update, updated util.M)

func (HttpAgent) SetSessionVal

func (a HttpAgent) SetSessionVal(key string, val any)

func (*HttpAgent) Start

func (a *HttpAgent) Start()

func (HttpAgent) UpdateAddr

func (a HttpAgent) UpdateAddr(addr string)

func (*HttpAgent) UpdateTimestamp

func (a *HttpAgent) UpdateTimestamp()

type HttpDialer

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

func NewHttpDialer

func NewHttpDialer(host string) *HttpDialer

func (*HttpDialer) Get

func (a *HttpDialer) Get(relative string, req, res util.IMsg) *util.Err

func (*HttpDialer) Host

func (a *HttpDialer) Host() string

func (*HttpDialer) Post

func (a *HttpDialer) Post(relative string, req, res util.IMsg) *util.Err

func (*HttpDialer) SetHost

func (a *HttpDialer) SetHost(host string)

type HttpListener

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

func NewHttpListener

func NewHttpListener(addr string, handlers []kiwi.IHttpHandler) *HttpListener

func (*HttpListener) Addr

func (l *HttpListener) Addr() string

func (*HttpListener) Close

func (l *HttpListener) Close()

func (*HttpListener) Port

func (l *HttpListener) Port() int

func (*HttpListener) Start

func (l *HttpListener) Start() *util.Err

Source Files

  • agent.go
  • http_agent.go
  • http_dialer.go
  • http_listener.go
  • socket_agent.go
  • tcp_agent.go
  • tcp_dialer.go
  • tcp_listener.go
  • udp_agent.go
  • udp_dialer.go
  • udp_listener.go
  • web_agent.go
  • web_dialer.go
  • web_listener.go

Jump to

Keyboard shortcuts

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