Documentation ¶
Overview ¶
Package websocket implements a websocket based transport for go-libp2p.
Index ¶
- Variables
- func ConvertWebsocketMultiaddrToNetAddr(maddr ma.Multiaddr) (net.Addr, error)
- func ParseWebsocketNetAddr(a net.Addr) (ma.Multiaddr, error)
- type Addr
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) LocalAddr() net.Addr
- func (c *Conn) Read(b []byte) (int, error)
- func (c *Conn) RemoteAddr() net.Addr
- func (c *Conn) SetDeadline(t time.Time) error
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) Write(b []byte) (n int, err error)
- type WebsocketTransport
- func (t *WebsocketTransport) CanDial(a ma.Multiaddr) bool
- func (t *WebsocketTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
- func (t *WebsocketTransport) Listen(a ma.Multiaddr) (transport.Listener, error)
- func (t *WebsocketTransport) Protocols() []int
- func (t *WebsocketTransport) Proxy() bool
Constants ¶
This section is empty.
Variables ¶
View Source
var GracefulCloseTimeout = 100 * time.Millisecond
GracefulCloseTimeout is the time to wait trying to gracefully close a connection before simply cutting it.
WsFmt is multiaddr formatter for WsProtocol
Functions ¶
Types ¶
type Addr ¶
Addr is an implementation of net.Addr for WebSocket.
type Conn ¶
Conn implements net.Conn interface for gorilla/websocket.
func (*Conn) Close ¶
Close closes the connection. Only the first call to Close will receive the close error, subsequent and concurrent calls will return nil. This method is thread-safe.
func (*Conn) RemoteAddr ¶
type WebsocketTransport ¶
type WebsocketTransport struct {
// contains filtered or unexported fields
}
WebsocketTransport is the actual go-libp2p transport
func New ¶
func New(u transport.Upgrader, rcmgr network.ResourceManager) *WebsocketTransport
func (*WebsocketTransport) Dial ¶
func (t *WebsocketTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (transport.CapableConn, error)
func (*WebsocketTransport) Protocols ¶
func (t *WebsocketTransport) Protocols() []int
func (*WebsocketTransport) Proxy ¶
func (t *WebsocketTransport) Proxy() bool
Source Files ¶
Click to show internal directories.
Click to hide internal directories.