server

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAddress = ":0"
	DefaultName    = "go.ebrick.server"
	DefaultVersion = "latest"
)

Functions

This section is empty.

Types

type Option

type Option func(*Options)

func WithAddress

func WithAddress(address string) Option

func WithAdvertise

func WithAdvertise(advertise string) Option

func WithContext

func WithContext(ctx context.Context) Option

func WithId

func WithId(id string) Option

func WithName

func WithName(name string) Option

func WithRouter

func WithRouter(router Router) Option

func WithVersion

func WithVersion(version string) Option

type Options

type Options struct {
	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context

	// The router for requests
	Router Router

	Name      string
	Id        string
	Version   string
	Advertise string
	Address   string
}

func NewOptions

func NewOptions(opts ...Option) Options

type Router

type Router interface {
}

type Server

type Server interface {
	// Initialize options
	Init(...Option) error
	// Retrieve the options
	Options() Options
	// Start the server
	Start() error
	// Stop the server
	Stop() error
}

Server defines the interface for a server with methods to initialize, start, and stop the server, as well as retrieve its options.

Jump to

Keyboard shortcuts

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