Documentation ¶
Index ¶
- func CreateMemFD(name string) (path string, err error)
- func CreateTCPSocket(port int) (socket net.Listener, err error)
- func CreateUnixSocket(name string) (socket net.Listener, err error)
- func LoadCompressedData(datafile string, dest interface{}) error
- func SaveDataCompressed(datafile string, src interface{}) error
- func StartLocalServer(port int, clientHandler func(net.Conn), connErrHook func(error)) error
- func StartServer(port int, hostname string, clientHandler func(net.Conn), ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMemFD ¶
CreateMemFD creates an anonymous file and then returns the path for the created file.
func CreateTCPSocket ¶
CreateTCPSocket creates a socket listening on the loopback interface with the specified port.
func CreateUnixSocket ¶
CreateUnixSocket tries to create a unix socket with the specified name. Tries to use the path from env XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, the socket is created in /tmp.
func LoadCompressedData ¶
LoadCompressedData loads the file specified by the path, zstd decompresses it and the tries to unmarshal it into the provided struct.
func SaveDataCompressed ¶
SaveDataCompressed marshals the provided struct, zstd compresses it and the writes it to the file specified by the provided path.
func StartLocalServer ¶
StartLocalServer is a wrapper for StartServer which uses "localhost" as the hostname. This makes the server only available for local connections.
func StartServer ¶
func StartServer(port int, hostname string, clientHandler func(net.Conn), connErrHook func(error)) error
StartServer opens a listener on the specified interface and port and passes connections to the provided handler, which is the startet as a new goroutine. The hostname can be omitted to listen on all interfaces.
Types ¶
This section is empty.