streamserver

package
v0.0.0-...-1643519 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StreamServer

type StreamServer interface {
	// Performs initial connection and setup, entering a listening state.
	Listen() error

	// Address returns a string that can be used by the "streamclient" package to
	// return a client for this StreamServer.
	//
	// Full package is:
	// go.chromium.org/luci/logdog/butlerlib/streamclient
	//
	// Address may only be called while the StreamServer is actively listening.
	Address() string

	// Blocks, returning a new Stream when one is available. If the stream server
	// has closed, this will return nil.
	Next() (io.ReadCloser, *streamproto.Properties)

	// Closes the stream server, cleaning up resources.
	Close()
}

StreamServer is an interface to a backgound service that allows external processes to establish Butler streams.

func NewTCP4Server

func NewTCP4Server(ctx context.Context, spec string) (StreamServer, error)

NewTCP4Server creates a new TCP/IP4 stream server.

spec is a string of the form [addr][:port].

If addr is not empty, it will be an IPv4 network address to bind to. If it is empty, the StreamServer will bind exclusively to localhost.

port must be a valid, available port. It may be omitted or <=0, in which case an ephemeral port will be chosen by the system. Note that, in this case, the caller cannot prescribe the port in advance, and must discover it via exported stream server parameters (externally) or by calling Address (internally).

func NewTCP6Server

func NewTCP6Server(ctx context.Context, spec string) (StreamServer, error)

NewTCP6Server creates a new TCP/IP6 stream server.

spec is a string of the form [addr][:port].

If addr is not empty, it will be an IPv6 network address to bind to. If it is empty, the StreamServer will bind exclusively to localhost.

port must be a valid, available port. It may be omitted or <=0, in which case an ephemeral port will be chosen by the system. Note that, in this case, the caller cannot prescribe the port in advance, and must discover it via exported stream server parameters (externally) or by calling Address (internally).

func NewUNIXDomainSocketServer

func NewUNIXDomainSocketServer(ctx context.Context, path string) (StreamServer, error)

NewUNIXDomainSocketServer instantiates a new POSIX domain soecket server instance.

No resources are actually created until methods are called on the returned server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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