Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package server describes a remote hive server: the ssh target a client reaches its daemon through.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidState = fmt.Errorf("not a valid State, try [%s]", strings.Join(_StateNames, ", "))

Functions

func StateNames

func StateNames() []string

StateNames returns a list of possible string values of State.

Types

type Host

type Host struct {
	// Name is an ssh host or config alias, optionally with user@.
	Name string
	// ConfigFile is passed to ssh as -F when set.
	ConfigFile string
	// Binary is the hive path on the remote host. Empty means "hive".
	Binary string
}

func (Host) Validate

func (h Host) Validate() error

Validate keeps Name from reading as an ssh option and Binary from carrying shell syntax, since ssh hands the remote command to a shell.

type State

type State string

State is how a client last found a server. Connecting means no check has answered yet. Incompatible means the daemon answered with a version this client cannot use.

ENUM(connecting, connected, offline, incompatible)

const (
	// StateConnecting is a State of type connecting.
	StateConnecting State = "connecting"
	// StateConnected is a State of type connected.
	StateConnected State = "connected"
	// StateOffline is a State of type offline.
	StateOffline State = "offline"
	// StateIncompatible is a State of type incompatible.
	StateIncompatible State = "incompatible"
)

func ParseState

func ParseState(name string) (State, error)

ParseState attempts to convert a string to a State.

func (*State) AppendText

func (x *State) AppendText(b []byte) ([]byte, error)

AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.

Implementations must not retain b, nor mutate any bytes within b[:len(b)].

func (State) IsValid

func (x State) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (State) MarshalText

func (x State) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (State) String

func (x State) String() string

String implements the Stringer interface.

func (*State) UnmarshalText

func (x *State) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

Jump to

Keyboard shortcuts

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