sluice

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: AGPL-3.0 Imports: 19 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (

	// EnableListener indicates if it should start the sluice listeners. Must be set at startup.
	EnableListener bool = true
)

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

func ListenPacket(network, address string) (net.Listener, error)

ListenPacket creates a packet listener.

func ListenUDP added in v0.4.7

func ListenUDP(network, address string) (net.Listener, error)

ListenUDP 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

type ListenerFactory func(network, address string) (net.Listener, error)

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.

func (*PacketConn) Write added in v0.3.0

func (conn *PacketConn) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

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

func (s *Sluice) AwaitRequest(r *Request)

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

func (conn *UDPConn) Close() error

Close is a no-op as UDP connections share a single socket. Just stop sending packets without closing.

func (*UDPConn) LocalAddr added in v0.4.7

func (conn *UDPConn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*UDPConn) Read added in v0.4.7

func (conn *UDPConn) 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 (*UDPConn) RemoteAddr added in v0.4.7

func (conn *UDPConn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*UDPConn) SetDeadline added in v0.4.7

func (conn *UDPConn) SetDeadline(t time.Time) error

SetDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) SetReadDeadline added in v0.4.7

func (conn *UDPConn) SetReadDeadline(t time.Time) error

SetReadDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) SetWriteDeadline added in v0.4.7

func (conn *UDPConn) SetWriteDeadline(t time.Time) error

SetWriteDeadline is a no-op as UDP connections share a single socket.

func (*UDPConn) Write added in v0.4.7

func (conn *UDPConn) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return an error after a fixed time limit; see SetDeadline and SetWriteDeadline.

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.

Jump to

Keyboard shortcuts

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