netutil

package
v0.0.0-...-a5f7211 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Net utilities - there's quite a lot of ceremony setting up a unix socket in a robust way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelableListen

func CancelableListen(
	ctx context.Context,
	listener net.Listener,
	listen func() error,
	logger *log.Logger,
) error

wraps use of net.Listener with context cancellation. ignores listen error if context was canceled (Accept()-related errors are expected then)

func CancelableServe

func CancelableServe(ctx context.Context, listener net.Listener, serve func(conn net.Conn)) error

*serve* is called on a separate goroutine

func ListenUnixAllowEveryone

func ListenUnixAllowEveryone(ctx context.Context, sockPath string, with func(net.Listener) error) error

func ListenUnixAllowOwner

func ListenUnixAllowOwner(ctx context.Context, sockPath string, with func(net.Listener) error) error

func ListenUnixAllowOwnerAndGroup

func ListenUnixAllowOwnerAndGroup(ctx context.Context, sockPath string, with func(net.Listener) error) error

func ListenUnixWithMode

func ListenUnixWithMode(
	ctx context.Context,
	sockPath string,
	mode *os.FileMode,
	with func(net.Listener) error,
) error

pass nil os.FileMode if you don't want to Chmod() the socket file

Types

This section is empty.

Jump to

Keyboard shortcuts

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