connection

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

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

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	QuicConfig = &quic.Config{
		MaxIdleTimeout:  5 * time.Second,
		KeepAlivePeriod: 15 * time.Second,
	}
)

Functions

func NewQuicStream

func NewQuicStream(connId string, localAddr, remoteAddr net.Addr, stream quic.Stream) connection.Stream

func NewTcpStream

func NewTcpStream(connId string, stream *smux.Stream) connection.Stream

func QuicNetwork

func QuicNetwork(uri *url.URL) string

func SetTcpOptions

func SetTcpOptions(conn net.Conn) (err error)

Types

type QuicConnection

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

func NewQuicConnection

func NewQuicConnection(connId string, udpConn net.PacketConn, quicConn quic.Connection) *QuicConnection

func (*QuicConnection) AcceptStream

func (c *QuicConnection) AcceptStream() (connection.Stream, error)

func (*QuicConnection) Close

func (c *QuicConnection) Close() error

func (*QuicConnection) ConnectionState

func (c *QuicConnection) ConnectionState() tls.ConnectionState

func (*QuicConnection) LocalAddr

func (c *QuicConnection) LocalAddr() net.Addr

func (*QuicConnection) OpenStream

func (c *QuicConnection) OpenStream() (connection.Stream, error)

func (*QuicConnection) RemoteAddr

func (c *QuicConnection) RemoteAddr() net.Addr

func (*QuicConnection) SetDeadline

func (c *QuicConnection) SetDeadline(_ time.Time) error

func (*QuicConnection) SetReadDeadline

func (c *QuicConnection) SetReadDeadline(_ time.Time) error

func (*QuicConnection) SetWriteDeadline

func (c *QuicConnection) SetWriteDeadline(_ time.Time) error

type QuicStream

type QuicStream struct {
	quic.Stream
	*StreamReadWriter
	// contains filtered or unexported fields
}

func (*QuicStream) Close

func (q *QuicStream) Close() error

func (*QuicStream) LocalAddr

func (q *QuicStream) LocalAddr() net.Addr

func (*QuicStream) RemoteAddr

func (q *QuicStream) RemoteAddr() net.Addr

type StreamReadWriter

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

func (*StreamReadWriter) GetConnectionId

func (rw *StreamReadWriter) GetConnectionId() string

func (*StreamReadWriter) GetNodeId

func (rw *StreamReadWriter) GetNodeId() common.NodeID

func (*StreamReadWriter) ReadMessage

func (rw *StreamReadWriter) ReadMessage(message proto.Message) error

func (*StreamReadWriter) SetNodeId

func (rw *StreamReadWriter) SetNodeId(nodeId common.NodeID)

func (*StreamReadWriter) WriteMessage

func (rw *StreamReadWriter) WriteMessage(m proto.Message) error

type TcpConnection

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

func NewTcpConnectionClient

func NewTcpConnectionClient(connId string, conn *tls.Conn) (*TcpConnection, error)

func NewTcpConnectionServer

func NewTcpConnectionServer(connId string, conn *tls.Conn) (*TcpConnection, error)

func (*TcpConnection) AcceptStream

func (c *TcpConnection) AcceptStream() (connection.Stream, error)

func (*TcpConnection) Close

func (c *TcpConnection) Close() error

func (*TcpConnection) ConnectionState

func (c *TcpConnection) ConnectionState() tls.ConnectionState

func (*TcpConnection) LocalAddr

func (c *TcpConnection) LocalAddr() net.Addr

func (*TcpConnection) OpenStream

func (c *TcpConnection) OpenStream() (connection.Stream, error)

func (*TcpConnection) RemoteAddr

func (c *TcpConnection) RemoteAddr() net.Addr

func (*TcpConnection) SetDeadline

func (c *TcpConnection) SetDeadline(t time.Time) error

func (*TcpConnection) SetReadDeadline

func (c *TcpConnection) SetReadDeadline(t time.Time) error

func (*TcpConnection) SetWriteDeadline

func (c *TcpConnection) SetWriteDeadline(t time.Time) error

type TcpStream

type TcpStream struct {
	*smux.Stream
	*StreamReadWriter
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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