unix

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RelayData

func RelayData(s *network.Server, orig, relay *network.Conn)

原样复制输入和输出

Types

type IRouter

type IRouter interface {
	Dispatch(c *network.Conn) (string, *network.DialPlan)
}

type Proxy

type Proxy struct {
	Options network.TCPOptions
	*network.Server
	// contains filtered or unexported fields
}

转发代理

func NewProxy

func NewProxy(kind, host string, port uint16) *Proxy

创建TCP/UDP代理

func (*Proxy) CreateClient

func (p *Proxy) CreateClient(kind string, dp *network.DialPlan) (client network.IClient)

func (*Proxy) CreateProcess

func (p *Proxy) CreateProcess(router IRouter, action ProxyAction) network.ProcessFunc

func (*Proxy) Run

func (p *Proxy) Run(events network.Events) (err error)

type ProxyAction

type ProxyAction func(s *network.Server, orig, relay *network.Conn)

type Relayer

type Relayer struct {
	Kind string
	*network.DialPlan
}

func NewRelayer

func NewRelayer(addr net.Addr) *Relayer

func NewUnixRelayer

func NewUnixRelayer(addr net.Addr) *Relayer

func (*Relayer) Dispatch

func (r *Relayer) Dispatch(c *network.Conn) (string, *network.DialPlan)

type UnixClient

type UnixClient struct {
	Conn *network.Conn
	// contains filtered or unexported fields
}

Unix socket 客户端.

func NewClient

func NewClient(plan *network.DialPlan, opts network.Options) *UnixClient

创建Unix客户端

func (*UnixClient) Close

func (c *UnixClient) Close() error

func (*UnixClient) Dialing

func (c *UnixClient) Dialing() (*network.Conn, error)

func (*UnixClient) GetConn

func (c *UnixClient) GetConn() *network.Conn

func (*UnixClient) GetPlan

func (c *UnixClient) GetPlan() *network.DialPlan

func (*UnixClient) SetConn

func (c *UnixClient) SetConn(conn *network.Conn)

type UnixServer

type UnixServer struct {
	*network.Server
	// contains filtered or unexported fields
}

Unix socket 服务器

func NewServer

func NewServer(server *network.Server) *UnixServer

创建Unix服务器

func (*UnixServer) Run

func (s *UnixServer) Run(events network.Events) (err error)

开始服务,接受客户端连接,并进行读写

func (*UnixServer) Shutdown

func (s *UnixServer) Shutdown(events network.Events) (err error)

服务停止阶段,关闭每一个网络连接

func (*UnixServer) Startup

func (s *UnixServer) Startup(events network.Events) (err error)

服务启动阶段,执行Tick事件

Jump to

Keyboard shortcuts

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