server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet exports for wire DI.

Functions

func NewConfig

func NewConfig(configPath string) (*viper.Viper, error)

NewConfig returns viper config.

Types

type BoreServer

type BoreServer struct {
	UI http.Handler
	// contains filtered or unexported fields
}

BoreServer defines main struct for bore server and includes HTTP and SSH server instances.

func NewBoreServer

func NewBoreServer(opts *Options, logger *zap.Logger) *BoreServer

NewBoreServer returns new instance of BoreServer.

func (*BoreServer) Run

func (s *BoreServer) Run() error

Run starts the bore server.

type DashboardMessage added in v0.5.0

type DashboardMessage struct {
	Type        string          `json:"type"`
	Tunnels     []TunnelMetrics `json:"tunnels"`
	ServerStats ServerStats     `json:"serverStats"`
}

type HTTPServer

type HTTPServer struct {
	*http.Server
	// contains filtered or unexported fields
}

HTTPServer extends net/http Server with graceful shutdowns.

func NewHTTPServer

func NewHTTPServer(logger *zap.SugaredLogger) *HTTPServer

NewHTTPServer creates a new HTTPServer instance.

func (*HTTPServer) Close

func (h *HTTPServer) Close() error

Close closes the HTTPServer instance

func (*HTTPServer) Run

func (h *HTTPServer) Run(addr string, handler http.Handler) error

Run starts HTTPServer instance and listens on specified addr.

func (*HTTPServer) Wait

func (h *HTTPServer) Wait() error

Wait waits for server to be stopped

type MetricsHub added in v0.5.0

type MetricsHub struct {
	// contains filtered or unexported fields
}

func NewMetricsHub added in v0.5.0

func NewMetricsHub(sshServer *SSHServer, logger *zap.SugaredLogger) *MetricsHub

func (*MetricsHub) Close added in v0.5.0

func (h *MetricsHub) Close()

func (*MetricsHub) HandleWebSocket added in v0.5.0

func (h *MetricsHub) HandleWebSocket(w http.ResponseWriter, r *http.Request)

func (*MetricsHub) RecordTraffic added in v0.5.0

func (h *MetricsHub) RecordTraffic(tunnelID string, bytesIn, bytesOut uint64)

type Options

type Options struct {
	Domain     string
	PrivateKey string
	PublicKey  string
	SSHAddr    string
	HTTPAddr   string
	Logger     *logger.Options
}

Options are global config for bore server.

func NewOptions

func NewOptions(v *viper.Viper) (*Options, error)

NewOptions returns server config.

type SSHServer

type SSHServer struct {
	// contains filtered or unexported fields
}

SSHServer defines SSH server instance.

func NewSSHServer

func NewSSHServer(opts *Options, logger *zap.SugaredLogger) *SSHServer

NewSSHServer returns new instance of SSHServer.

func (*SSHServer) Close

func (s *SSHServer) Close() error

Close closes and stops the SSH server.

func (*SSHServer) Run

func (s *SSHServer) Run() error

Run starts the SSH server.

func (*SSHServer) Wait

func (s *SSHServer) Wait() error

Wait waits for server to be stopped

type ServerStats added in v0.5.0

type ServerStats struct {
	TotalBytesIn       uint64  `json:"totalBytesIn"`
	TotalBytesOut      uint64  `json:"totalBytesOut"`
	CumulativeBytesIn  uint64  `json:"cumulativeBytesIn"`
	CumulativeBytesOut uint64  `json:"cumulativeBytesOut"`
	ThroughputIn       float64 `json:"throughputIn"`
	ThroughputOut      float64 `json:"throughputOut"`
}

type TunnelMetrics added in v0.5.0

type TunnelMetrics struct {
	ID                 string    `json:"id"`
	Domain             string    `json:"domain"`
	Port               uint32    `json:"port"`
	Addr               string    `json:"addr"`
	BytesIn            uint64    `json:"bytesIn"`
	BytesOut           uint64    `json:"bytesOut"`
	CumulativeBytesIn  uint64    `json:"cumulativeBytesIn"`
	CumulativeBytesOut uint64    `json:"cumulativeBytesOut"`
	ThroughputIn       float64   `json:"throughputIn"`
	ThroughputOut      float64   `json:"throughputOut"`
	ConnectedAt        time.Time `json:"connectedAt"`
	LastActivity       time.Time `json:"lastActivity"`
	ActiveConnections  int       `json:"activeConnections"`
}

Jump to

Keyboard shortcuts

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