chserver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	KeySeed      string
	KeyFile      string
	AuthFile     string
	Auth         string
	Proxy        string
	Socks5       bool
	Reverse      bool
	KeepAlive    time.Duration
	TLS          TLSConfig
	OTELEnabled  bool
	OTELEndpoint string
}

Config is the configuration for the chisel service

type EndpointSnapshot

type EndpointSnapshot struct {
	SessionID  string
	Descriptor string
	Status     EndpointStatus
	LastError  string
	UpdatedAt  time.Time
}

type EndpointStatus

type EndpointStatus string
const (
	EndpointStatusPending EndpointStatus = "pending"
	EndpointStatusActive  EndpointStatus = "active"
	EndpointStatusFailed  EndpointStatus = "failed"
	EndpointStatusClosed  EndpointStatus = "closed"
)

type MonitorCounters

type MonitorCounters struct {
	PendingSessions      int
	ConnectedSessions    int
	FailedSessions       int
	DisconnectedSessions int
	PendingEndpoints     int
	ActiveEndpoints      int
	FailedEndpoints      int
	ClosedEndpoints      int
}

type MonitorSnapshot

type MonitorSnapshot struct {
	Sessions  []SessionSnapshot
	Endpoints []EndpointSnapshot
	Counters  MonitorCounters
}

type Server

type Server struct {
	*cio.Logger
	// contains filtered or unexported fields
}

Server respresent a chisel service

func NewServer

func NewServer(c *Config) (*Server, error)

NewServer creates and returns a new chisel server

func (*Server) AddUser

func (s *Server) AddUser(user, pass string, addrs ...string) error

AddUser adds a new user into the server user index

func (*Server) Close

func (s *Server) Close() error

Close forcibly closes the http server

func (*Server) DeleteUser

func (s *Server) DeleteUser(user string)

DeleteUser removes a user from the server user index

func (*Server) GetFingerprint

func (s *Server) GetFingerprint() string

GetFingerprint is used to access the server fingerprint

func (*Server) MonitorSnapshot

func (s *Server) MonitorSnapshot() MonitorSnapshot

MonitorSnapshot returns a copy of monitor session/endpoint telemetry.

func (*Server) ResetUsers

func (s *Server) ResetUsers(users []*settings.User)

ResetUsers in the server user index. Use nil to remove all.

func (*Server) Run

func (s *Server) Run(host, port string) error

Run is responsible for starting the chisel service. Internally this calls Start then Wait.

func (*Server) Start

func (s *Server) Start(host, port string) error

Start is responsible for kicking off the http server

func (*Server) StartContext

func (s *Server) StartContext(ctx context.Context, host, port string) error

StartContext is responsible for kicking off the http server, and can be closed by cancelling the provided context

func (*Server) Wait

func (s *Server) Wait() error

Wait waits for the http server to close

type SessionSnapshot

type SessionSnapshot struct {
	SessionID   string
	RemoteAddr  string
	Status      SessionStatus
	Error       string
	StartedAt   time.Time
	ConnectedAt time.Time
	UpdatedAt   time.Time
}

type SessionStatus

type SessionStatus string
const (
	SessionStatusPending      SessionStatus = "pending"
	SessionStatusConnected    SessionStatus = "connected"
	SessionStatusFailed       SessionStatus = "failed"
	SessionStatusDisconnected SessionStatus = "disconnected"
)

type TLSConfig

type TLSConfig struct {
	Key     string
	Cert    string
	Domains []string
	CA      string
}

TLSConfig enables configures TLS

Jump to

Keyboard shortcuts

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