Documentation ¶
Index ¶
- func Dial(protocol, addr string) error
- func DialWithDialer(dialer *net.Dialer, protocol, addr string) error
- func StartHost(ctx context.Context, listenF int)
- type Client
- type ConnID
- type IBroadcaster
- type TCPBasicServer
- func (s *TCPBasicServer) Broadcast(msg []byte) error
- func (s *TCPBasicServer) Listen(port int) error
- func (s *TCPBasicServer) OnReceive() <-chan []byte
- func (s *TCPBasicServer) OnRegister() <-chan TCPServerConn
- func (s *TCPBasicServer) OnUnregister() <-chan TCPServerConn
- func (s *TCPBasicServer) Send(cid uuid.UUID, msg []byte) error
- type TCPClient
- type TCPServer
- type TCPServerConn
- type UDPServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type IBroadcaster ¶
type IBroadcaster interface { Broadcast(message []byte) error OnBroadcaster() Send(addr string, message []byte) error }
func NewUDPServer ¶
func NewUDPServer(port, dialPort int) IBroadcaster
type TCPBasicServer ¶
type TCPBasicServer struct {
// contains filtered or unexported fields
}
func (*TCPBasicServer) Broadcast ¶
func (s *TCPBasicServer) Broadcast(msg []byte) error
Broadcast implements TCPServer
func (*TCPBasicServer) Listen ¶
func (s *TCPBasicServer) Listen(port int) error
func (*TCPBasicServer) OnReceive ¶
func (s *TCPBasicServer) OnReceive() <-chan []byte
OnReceive implements TCPServer
func (*TCPBasicServer) OnRegister ¶
func (s *TCPBasicServer) OnRegister() <-chan TCPServerConn
OnRegister implements TCPServer
func (*TCPBasicServer) OnUnregister ¶
func (s *TCPBasicServer) OnUnregister() <-chan TCPServerConn
OnUnregister implements TCPServer
type TCPClient ¶
type TCPClient interface { Close() OnClose() <-chan bool Dia(url string) error Send(msg []byte) error OnReceive() <-chan []byte SetWriter(writer io.Writer) }
func NewTCPClient ¶
func NewTCPClient() TCPClient
type TCPServer ¶
type TCPServer interface { Listen(port int) error OnRegister() <-chan TCPServerConn OnUnregister() <-chan TCPServerConn OnReceive() <-chan []byte Send(cid ConnID, msg []byte) error Broadcast(msg []byte) error }
func NewTCPServer ¶
func NewTCPServer() TCPServer
type TCPServerConn ¶
type TCPServerConn struct { ID ConnID // contains filtered or unexported fields }
func (TCPServerConn) Send ¶
func (c TCPServerConn) Send(message []byte) error
type UDPServer ¶
type UDPServer struct {
// contains filtered or unexported fields
}
func (*UDPServer) OnBroadcaster ¶
func (b *UDPServer) OnBroadcaster()
Click to show internal directories.
Click to hide internal directories.