Documentation ¶
Index ¶
- Variables
- func AwaitRequest(connInfo *network.Connection, callbackFn RequestCallbackFunc) error
- func ListenPacket(network, address string) (net.Listener, error)
- func ListenUDP(network, address string) (net.Listener, error)
- func StartSluice(network, address string)
- type ListenerFactory
- type PacketConn
- func (conn *PacketConn) Close() error
- func (conn *PacketConn) LocalAddr() net.Addr
- func (conn *PacketConn) Read(b []byte) (n int, err error)
- func (conn *PacketConn) RemoteAddr() net.Addr
- func (conn *PacketConn) SetDeadline(t time.Time) error
- func (conn *PacketConn) SetReadDeadline(t time.Time) error
- func (conn *PacketConn) SetWriteDeadline(t time.Time) error
- func (conn *PacketConn) Write(b []byte) (n int, err error)
- type PacketListener
- type Request
- type RequestCallbackFunc
- type Sluice
- type UDPConn
- func (conn *UDPConn) Close() error
- func (conn *UDPConn) LocalAddr() net.Addr
- func (conn *UDPConn) Read(b []byte) (n int, err error)
- func (conn *UDPConn) RemoteAddr() net.Addr
- func (conn *UDPConn) SetDeadline(t time.Time) error
- func (conn *UDPConn) SetReadDeadline(t time.Time) error
- func (conn *UDPConn) SetWriteDeadline(t time.Time) error
- func (conn *UDPConn) Write(b []byte) (n int, err error)
- type UDPListener
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported is returned when a protocol is not supported. ErrUnsupported = errors.New("unsupported protocol") // ErrSluiceOffline is returned when the sluice for a network is offline. ErrSluiceOffline = errors.New("is offline") )
Functions ¶
func AwaitRequest ¶
func AwaitRequest(connInfo *network.Connection, callbackFn RequestCallbackFunc) error
AwaitRequest pre-registers a connection at the sluice for initializing it when it arrives.
func ListenPacket ¶ added in v0.3.0
ListenPacket creates a packet listener.
func StartSluice ¶ added in v0.3.0
func StartSluice(network, address string)
StartSluice starts a sluice listener at the given address.
Types ¶
type ListenerFactory ¶ added in v0.3.0
ListenerFactory defines a function to create a listener.
type PacketConn ¶ added in v0.3.0
type PacketConn struct {
// contains filtered or unexported fields
}
PacketConn simulates a connection for a stateless protocol.
func (*PacketConn) Close ¶ added in v0.3.0
func (conn *PacketConn) Close() error
Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.
func (*PacketConn) LocalAddr ¶ added in v0.3.0
func (conn *PacketConn) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*PacketConn) Read ¶ added in v0.3.0
func (conn *PacketConn) Read(b []byte) (n int, err error)
Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*PacketConn) RemoteAddr ¶ added in v0.3.0
func (conn *PacketConn) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.
func (*PacketConn) SetDeadline ¶ added in v0.3.0
func (conn *PacketConn) SetDeadline(t time.Time) error
SetDeadline is a no-op as UDP connections share a single socket.
func (*PacketConn) SetReadDeadline ¶ added in v0.3.0
func (conn *PacketConn) SetReadDeadline(t time.Time) error
SetReadDeadline is a no-op as UDP connections share a single socket.
func (*PacketConn) SetWriteDeadline ¶ added in v0.3.0
func (conn *PacketConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline is a no-op as UDP connections share a single socket.
type PacketListener ¶ added in v0.3.0
type PacketListener struct {
// contains filtered or unexported fields
}
PacketListener is a listener for packet based protocols.
func (*PacketListener) Accept ¶ added in v0.3.0
func (ln *PacketListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
func (*PacketListener) Addr ¶ added in v0.3.0
func (ln *PacketListener) Addr() net.Addr
Addr returns the listener's network address.
func (*PacketListener) Close ¶ added in v0.3.0
func (ln *PacketListener) Close() error
Close closes the listener. Any blocked Accept operations will be unblocked and return errors.
type Request ¶
type Request struct { ConnInfo *network.Connection CallbackFn RequestCallbackFunc Expires time.Time }
Request holds request data for a sluice entry.
type RequestCallbackFunc ¶ added in v0.3.0
type RequestCallbackFunc func(connInfo *network.Connection, conn net.Conn)
RequestCallbackFunc is called for taking a over handling connection that arrived at the sluice.
type Sluice ¶
type Sluice struct {
// contains filtered or unexported fields
}
Sluice is a tunnel entry listener.
func (*Sluice) AwaitRequest ¶
AwaitRequest pre-registers a connection.
type UDPConn ¶ added in v0.4.7
type UDPConn struct {
// contains filtered or unexported fields
}
UDPConn simulates a connection for a stateless protocol.
func (*UDPConn) Close ¶ added in v0.4.7
Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.
func (*UDPConn) Read ¶ added in v0.4.7
Read reads data from the connection. Read can be made to time out and return an error after a fixed time limit; see SetDeadline and SetReadDeadline.
func (*UDPConn) RemoteAddr ¶ added in v0.4.7
RemoteAddr returns the remote network address.
func (*UDPConn) SetDeadline ¶ added in v0.4.7
SetDeadline is a no-op as UDP connections share a single socket.
func (*UDPConn) SetReadDeadline ¶ added in v0.4.7
SetReadDeadline is a no-op as UDP connections share a single socket.
func (*UDPConn) SetWriteDeadline ¶ added in v0.4.7
SetWriteDeadline is a no-op as UDP connections share a single socket.
type UDPListener ¶ added in v0.4.7
type UDPListener struct {
// contains filtered or unexported fields
}
UDPListener is a listener for UDP.
func (*UDPListener) Accept ¶ added in v0.4.7
func (ln *UDPListener) Accept() (net.Conn, error)
Accept waits for and returns the next connection to the listener.
func (*UDPListener) Addr ¶ added in v0.4.7
func (ln *UDPListener) Addr() net.Addr
Addr returns the listener's network address.
func (*UDPListener) Close ¶ added in v0.4.7
func (ln *UDPListener) Close() error
Close closes the listener. Any blocked Accept operations will be unblocked and return errors.