server

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2017 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// git rev-parse --short HEAD
	GitHash string

	// git describe --tags
	Version string
)

Build variables, set when building the binary

View Source
var ErrNoKnownHostsFile = errors.New("sshconfig: missing known hosts file")

ErrNoKnownHostsFile is returned when the KnownHostsFile field is empty.

Functions

This section is empty.

Types

type MetaConfig added in v0.0.10

type MetaConfig struct {
	KnownHostsFile string
	SSHDialTimeout time.Duration
	// contains filtered or unexported fields
}

MetaConfig holds configuration options to use to create SSH client configurations.

func (*MetaConfig) WithAgent added in v0.0.10

func (c *MetaConfig) WithAgent(user string) (*ssh.ClientConfig, error)

WithAgent returns an SSH ClientConfig that authenticates via the SSH agent.

type Server

type Server struct {
	// The address the server listens on.
	Addr net.Addr
	// The MetaConfig to use to create SSH ClientConfig.
	MetaConfig *MetaConfig

	// Duration before the tunnels stop if there is no active connection.
	TunnelIdleTimeout time.Duration
	// Write timeout before returning a network error on a write attempt.
	WriteTimeout time.Duration

	// If not nil, this is an expvar map that contains statistics about the server,
	// tunnels and connections.
	Stats *expvar.Map

	// The channel to send errors to. If nil, the errors are logged.
	// If the send would block, the error is dropped. It is the responsibility
	// of the caller to close the channel once the Server is stopped.
	// If set, this ErrChain is used for all Tunnels started by this
	// Server.
	ErrChan chan<- error
	// contains filtered or unexported fields
}

Server defines the regis-companion Server that listens for incoming connections and manages SSH tunnels.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(ctx context.Context) error

ListenAndServe starts the server on the specified Addr.

This call is blocking, it returns only when an error is encountered. As such, it always returns a non-nil error.

Jump to

Keyboard shortcuts

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