Documentation ¶
Index ¶
- Variables
- func DialUDP(addr string) (net.PacketConn, error)
- func ListenUDP(addr string) (net.PacketConn, error)
- type AddrMuxDialer
- type AddrMuxListener
- type ClientMuxer
- type ClientParams
- type ClientStreamAdapter
- type ClientStreamDialer
- type CommonParams
- type Creators
- func (c *Creators) AddrMuxDialers() *Registry[AddrMuxDialer]
- func (c *Creators) AddrMuxListeners() *Registry[AddrMuxListener]
- func (c *Creators) ChannelDialers() *Registry[PacketChannelDialer]
- func (c *Creators) ChannelListeners() *Registry[PacketChannelListener]
- func (c *Creators) ClientMuxers() *Registry[ClientMuxer]
- func (c *Creators) ClientStreamAdapters() *Registry[ClientStreamAdapter]
- func (c *Creators) MuxDialers() *Registry[MuxDialer]
- func (c *Creators) MuxListeners() *Registry[MuxListener]
- func (c *Creators) ServerMuxers() *Registry[ServerMuxer]
- func (c *Creators) ServerStreamAdapters() *Registry[ServerStreamAdapter]
- type DatagramCapableMuxedSocket
- type DatagramChannel
- type ListeningSocket
- type MuxDialer
- type MuxListener
- type MuxStream
- type MuxedAddr
- type MuxedListener
- type MuxedSocket
- type NetAddrPort
- type PacketChannelDialer
- type PacketChannelListener
- type Registry
- type ServerMuxer
- type ServerParams
- type ServerStreamAdapter
- type Socket
Constants ¶
This section is empty.
Variables ¶
var SchemeNotSupported = errors.New("scheme not supported")
Functions ¶
Types ¶
type AddrMuxDialer ¶
type AddrMuxDialer func(addr string, config *tls.Config) (MuxedSocket, error)
AddrMuxDialer is another all-in-one solution: It takes an address, returns the muxed socket connection.
func CreateDialer ¶
func CreateDialer(scheme string) (AddrMuxDialer, error)
CreateDialer enables to create a dialer function for the provided scheme and cache it. If you dial a scheme frequently, then you probably should use it and cache its result.
func CreateDialerWithRegistry ¶
func CreateDialerWithRegistry(creators *Creators, scheme string) (AddrMuxDialer, error)
CreateDialerWithRegistry is the same as CreateDialer but with 2 arguments: it takes your registry of creators instead of default.
type AddrMuxListener ¶
type AddrMuxListener func(addr string, config *tls.Config) (MuxedListener, error)
AddrMuxListener is another all-in-one solution, with the difference being: it takes an address instead of PacketConn.
func CreateListener ¶
func CreateListener(scheme string) (AddrMuxListener, error)
func CreateListenerWithRegistry ¶
func CreateListenerWithRegistry(creators *Creators, scheme string) (AddrMuxListener, error)
type ClientMuxer ¶
type ClientMuxer func(net.Conn, *ClientParams) (MuxedSocket, error)
ClientMuxer is used for example by smux, yamux, SPDY, etc.
type ClientParams ¶
type ClientParams struct { CommonParams // used with "WriteTo" method. a PacketConn only has "LocalAddr" of the local socket. RemoteAddr net.Addr }
func GetClientParamsFromURL ¶
func GetClientParamsFromURL(transportKey string, addr *url.URL) (*ClientParams, error)
type ClientStreamAdapter ¶
ClientStreamAdapter is used by packet-to-stream connection adapters. for example by KCP, eNet, etc.
type ClientStreamDialer ¶
ClientStreamDialer is used by packet-to-stream connection adapters. for example by KCP, eNet, etc.
type CommonParams ¶
func GetCommonParamsFromURL ¶
func GetCommonParamsFromURL(addr *url.URL) CommonParams
type Creators ¶
type Creators struct {
// contains filtered or unexported fields
}
func GlobalCreators ¶
func GlobalCreators() *Creators
func NewCreators ¶
func NewCreators() *Creators
func (*Creators) AddrMuxDialers ¶
func (c *Creators) AddrMuxDialers() *Registry[AddrMuxDialer]
func (*Creators) AddrMuxListeners ¶
func (c *Creators) AddrMuxListeners() *Registry[AddrMuxListener]
func (*Creators) ChannelDialers ¶
func (c *Creators) ChannelDialers() *Registry[PacketChannelDialer]
func (*Creators) ChannelListeners ¶
func (c *Creators) ChannelListeners() *Registry[PacketChannelListener]
func (*Creators) ClientMuxers ¶
func (c *Creators) ClientMuxers() *Registry[ClientMuxer]
func (*Creators) ClientStreamAdapters ¶
func (c *Creators) ClientStreamAdapters() *Registry[ClientStreamAdapter]
func (*Creators) MuxDialers ¶
func (*Creators) MuxListeners ¶
func (c *Creators) MuxListeners() *Registry[MuxListener]
func (*Creators) ServerMuxers ¶
func (c *Creators) ServerMuxers() *Registry[ServerMuxer]
func (*Creators) ServerStreamAdapters ¶
func (c *Creators) ServerStreamAdapters() *Registry[ServerStreamAdapter]
type DatagramCapableMuxedSocket ¶
type DatagramCapableMuxedSocket interface { MuxedSocket DatagramChannel }
type DatagramChannel ¶
type ListeningSocket ¶
type ListeningSocket interface { // Accept waits for and returns the next connection to the listener. Accept() (socket Socket, err error) // Close closes the listener. // Any blocked Accept operations will be unblocked and return errors. Close() error // Addr returns the listener's network address. Addr() net.Addr }
type MuxDialer ¶
type MuxDialer func(conn net.PacketConn, config *tls.Config, params *ClientParams) (MuxedSocket, error)
MuxDialer is the all-in-one solution: It takes a packet connection, returns a multiplexed secure streaming socket. Its sole purpose is for QUIC. (the only all-in-one solution we have at the moment!)
type MuxListener ¶
type MuxListener func(conn net.PacketConn, config *tls.Config, params *ServerParams) (MuxedListener, error)
MuxListener is the all-in-one solution: It takes a packet connection, returns a multiplexed secure streaming socket. Its sole purpose is for QUIC. (the only all-in-one solution we have at the moment!)
type MuxedAddr ¶
type MuxedSocket ¶
type MuxedSocket interface { Socket AcceptStream() (stream MuxStream, err error) OpenStream() (stream MuxStream, err error) }
func DialURI ¶
func DialURI(uri string, config *tls.Config) (MuxedSocket, error)
DialURI provides a standard way of dialing an address.
func DialURIWithRegistry ¶
DialURIWithRegistry is the same as DialURI except it supports providing custom registry of creators.
type NetAddrPort ¶
func GetAddrByTransportType ¶
func GetAddrByTransportType(transportKey string, addr string) (NetAddrPort, error)
type PacketChannelDialer ¶
type PacketChannelDialer func(addr string) (net.PacketConn, error)
PacketChannelDialer is used for example by UDP, ICMPChannel, etc.
type PacketChannelListener ¶
type PacketChannelListener func(addr string) (net.PacketConn, error)
PacketChannelListener is used for example by UDP, ICMPChannel, etc.
type ServerMuxer ¶
type ServerMuxer func(net.Listener, *ServerParams) (MuxedListener, error)
ServerMuxer is used for example by smux, yamux, SPDY, etc.
type ServerParams ¶
type ServerParams struct {
CommonParams
}
func GetServerParamsFromURL ¶
func GetServerParamsFromURL(_ string, addr *url.URL) (*ServerParams, error)
type ServerStreamAdapter ¶
type ServerStreamAdapter func(conn net.PacketConn) (net.Listener, error)
ServerStreamAdapter is used by packet-to-stream connection adapters. for example by KCP, eNet, etc.
type Socket ¶
type Socket interface { // Close closes the connection. // Any blocked operations on the socket will be unblocked and return errors. Close() error // LocalAddr returns the local network address, if known. LocalAddr() net.Addr // RemoteAddr returns the remote network address, if known. RemoteAddr() net.Addr }