network

package
v1.5.11 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListenWithFallback

func ListenWithFallback(addr, host string, port string) (net.Listener, error)

ListenWithFallback opens a TCP listener on `addr`. When `host` is a literal IP that the host kernel cannot bind (the typical "EADDRNOTAVAIL" error after restoring a backup from another machine), the function logs a warning and retries on the loopback interface (127.0.0.1) only. This keeps the panel reachable locally (e.g. over an SSH tunnel) so the operator can correct the listen address from the UI, without ever silently widening an intentionally-restricted bind to every (public) interface.

`host` is the bare host portion (no port) used by the caller to build `addr`; pass an empty string when the address is already an "any" address or when no fallback is desired.

func NewAutoHttpsConn

func NewAutoHttpsConn(conn net.Conn) net.Conn

func NewAutoHttpsListener

func NewAutoHttpsListener(listener net.Listener) net.Listener

Types

type AutoHttpsConn

type AutoHttpsConn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*AutoHttpsConn) Read

func (c *AutoHttpsConn) Read(buf []byte) (int, error)

type AutoHttpsListener

type AutoHttpsListener struct {
	net.Listener
}

func (*AutoHttpsListener) Accept

func (l *AutoHttpsListener) Accept() (net.Conn, error)

type ListenResult

type ListenResult struct {
	Listener      net.Listener
	RequestedAddr string
	FallbackAddr  string
	Fallback      bool
	BindError     error
}

func ListenWithFallbackResult

func ListenWithFallbackResult(addr, host string, port string) (ListenResult, error)

Jump to

Keyboard shortcuts

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