nets

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithServerName

func ContextWithServerName(ctx context.Context, name string) context.Context

func GetServerNameFromContext

func GetServerNameFromContext(ctx context.Context) (string, bool)

func HandleConnections added in v0.0.3

func HandleConnections(c1, c2 io.ReadWriteCloser) error

func HandleListener

func HandleListener(l net.Listener, h func(net.Conn)) error

func RunNetServer

func RunNetServer(ctx context.Context, s NetServer, l net.Listener) error

func SafeCloseConn added in v0.0.3

func SafeCloseConn(c io.ReadWriteCloser)

Types

type NetDialer

type NetDialer interface {
	DialContext(ctx context.Context, network, addr string) (net.Conn, error)
}
var DefaultNetDialer NetDialer = &net.Dialer{}

func ListenDialer

func ListenDialer() (net.Listener, NetDialer)

func ListenDialerWithBuffer

func ListenDialerWithBuffer(size int) (net.Listener, NetDialer)

func NetDialerWithConnModifier

func NetDialerWithConnModifier(d NetDialer, m func(net.Conn) net.Conn) NetDialer

func SocketsDialer

func SocketsDialer(h SocketHandler) NetDialer

type NetDialerFunc

type NetDialerFunc func(ctx context.Context, network, addr string) (net.Conn, error)

func (NetDialerFunc) DialContext

func (f NetDialerFunc) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

type NetServer

type NetServer interface {
	Serve(l net.Listener) error
	ListenAndServe() error
	Shutdown(ctx context.Context) error
}

func WrapTLSServer

func WrapTLSServer(s TLSServer, certFile, keyFile string) NetServer

type SSHDialer

type SSHDialer interface {
	DialContext(ctx context.Context, network, addr string, config *gossh.ClientConfig) (*gossh.Client, error)
}

func NetSSHDialer

func NetSSHDialer(netDialer NetDialer) SSHDialer

type SSHDialerFunc

type SSHDialerFunc func(ctx context.Context, network, addr string, config *gossh.ClientConfig) (*gossh.Client, error)

func (SSHDialerFunc) DialContext

func (f SSHDialerFunc) DialContext(ctx context.Context, network, addr string, config *gossh.ClientConfig) (*gossh.Client, error)

type SocketHandler

type SocketHandler interface {
	ConvertHostPortToSocket(host, port string) (string, bool)
	SocketAlive(socket string) bool
}

type TLSServer

type TLSServer interface {
	ServeTLS(l net.Listener, certFile, keyFile string) error
	ListenAndServeTLS(certFile, keyFile string) error
	Shutdown(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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