conn

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UDPMtu = 1200

UDPMtu mtu of udp

Functions

This section is empty.

Types

type PoolMgr

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

PoolMgr pool manager

func GetDefaultMgr

func GetDefaultMgr() *PoolMgr

GetDefaultMgr create default manager,support tcp,udp,ws,s2s

func NewMgr

func NewMgr() *PoolMgr

NewMgr new manager of connection pool

func (*PoolMgr) Close

func (mgr *PoolMgr) Close()

Close close

func (*PoolMgr) Dial

func (mgr *PoolMgr) Dial(addr string) (libp2p.Conn, error)

Dial dial,the address must be with scheme,such as:"tcp://user_id@127.0.0.1:1111"

func (*PoolMgr) Listen

func (mgr *PoolMgr) Listen(addr string, handle func(libp2p.Conn)) error

Listen listen,the address must be with scheme,such as:"tcp://127.0.0.1:1111"

func (*PoolMgr) RegConnPool

func (mgr *PoolMgr) RegConnPool(scheme string, c libp2p.ConnPool)

RegConnPool register new connection pool

type S2SPool

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

S2SPool udp server to udp server.

func (*S2SPool) Close

func (c *S2SPool) Close()

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*S2SPool) Dial

func (c *S2SPool) Dial(addr string) (libp2p.Conn, error)

Dial dial

func (*S2SPool) Listen

func (c *S2SPool) Listen(addr string, handle func(libp2p.Conn)) error

Listen listen

type TCPPool

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

TCPPool default connection,such as:tcp,unix

func (*TCPPool) Close

func (c *TCPPool) Close()

Close close the listener

func (*TCPPool) Dial

func (c *TCPPool) Dial(addr string) (libp2p.Conn, error)

Dial dial

func (*TCPPool) Listen

func (c *TCPPool) Listen(addr string, handle func(libp2p.Conn)) error

Listen listen

type UDPPool

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

UDPPool connection over udp,it could lose message.

func (*UDPPool) Close

func (c *UDPPool) Close()

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*UDPPool) Dial

func (c *UDPPool) Dial(addr string) (libp2p.Conn, error)

Dial dial

func (*UDPPool) Listen

func (c *UDPPool) Listen(addr string, handle func(libp2p.Conn)) error

Listen listen

type WSPool

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

WSPool websocker pool

func (*WSPool) Close

func (c *WSPool) Close()

Close closes the listener. Any blocked Accept operations will be unblocked and return errors.

func (*WSPool) Dial

func (c *WSPool) Dial(addr string) (libp2p.Conn, error)

Dial dial

func (*WSPool) Listen

func (c *WSPool) Listen(addr string, handle func(libp2p.Conn)) error

Listen listen

Jump to

Keyboard shortcuts

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