sio

package
v0.0.0-...-72cce0b Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMemFD

func CreateMemFD(name string) (path string, err error)

CreateMemFD creates an anonymous file and then returns the path for the created file.

func CreateTCPSocket

func CreateTCPSocket(port int) (socket net.Listener, err error)

CreateTCPSocket creates a socket listening on the loopback interface with the specified port.

func CreateUnixSocket

func CreateUnixSocket(name string) (socket net.Listener, err error)

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

func LoadCompressedData(datafile string, dest interface{}) error

LoadCompressedData loads the file specified by the path, zstd decompresses it and the tries to unmarshal it into the provided struct.

func SaveDataCompressed

func SaveDataCompressed(datafile string, src interface{}) error

SaveDataCompressed marshals the provided struct, zstd compresses it and the writes it to the file specified by the provided path.

func StartLocalServer

func StartLocalServer(port int, clientHandler func(net.Conn), connErrHook func(error)) error

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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