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

server

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package server runs the local SSLKnife web interface and REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsLoopback

func IsLoopback(listen string) bool

IsLoopback reports whether a listen address only accepts local connections.

Types

type CertificateDetail

type CertificateDetail struct {
	Summary  views.CertSummary     `json:"summary"`
	Details  certificate.Info      `json:"details"`
	Chain    []views.CertSummary   `json:"chain"`
	Issued   []views.CertSummary   `json:"issued"`
	Notes    []note                `json:"notes"`
	CT       []views.CTObservation `json:"ct"`
	History  []scanEntry           `json:"history"`
	Findings []certificate.Finding `json:"findings"`
}

CertificateDetail is the /certificates/{id} response.

type Dashboard

type Dashboard struct {
	Counts        inventory.Counts      `json:"counts"`
	CT            ctCounts              `json:"ct"`
	Expiring      []views.CertSummary   `json:"expiring"`
	RecentCerts   []views.CertSummary   `json:"recent_certificates"`
	RecentScans   []scanEntry           `json:"recent_scans"`
	CTDiscoveries []views.CTObservation `json:"ct_discoveries"`
	WeakFindings  []endpointFinding     `json:"weak_findings"`
}

Dashboard is the /dashboard response.

type Options

type Options struct {
	Listen       string
	PlainHTTP    bool   // serve HTTP instead of HTTPS (loopback only unless AllowInsecure)
	CertFile     string // optional TLS certificate/key files
	KeyFile      string
	Token        string // access token; random when empty
	AllowedHosts []string
	Config       *config.Config
	Logger       *slog.Logger
	Dialer       netdial.Dialer
	CTProvider   string
	CTToken      string
	CTBaseURL    string // alternative CT endpoint (self-hosted or test)
	Version      string
	Jobs         bool
	Static       fs.FS // web UI assets
	// Sync, when set, syncs the inventory with the remote every SyncInterval.
	Sync         func(context.Context) error
	SyncInterval time.Duration
}

Options configure the server.

type Server

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

Server is a running web interface bound to an unlocked vault.

func New

func New(ctx context.Context, db *database.DB, o Options) (*Server, error)

New prepares a server. It binds the listener so that port errors are reported before the URL is printed.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the bound address.

func (*Server) Fingerprint

func (s *Server) Fingerprint() string

Fingerprint is the SHA-256 of the server certificate (empty for HTTP).

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler builds the HTTP handler (exposed for tests).

func (*Server) Run

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

Run serves until ctx is cancelled, then shuts down gracefully.

func (*Server) Token

func (s *Server) Token() string

Token returns the access token (for API clients).

func (*Server) URL

func (s *Server) URL() string

URL returns the login URL including the access token.

Jump to

Keyboard shortcuts

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