Documentation
¶
Overview ¶
Package netaccess validates the installation's explicit network boundary. It has no authority to start motion, launch processes, or change a firewall.
Index ¶
- Constants
- func ClientIP(r *http.Request) string
- func HasForwardingHeaders(r *http.Request) bool
- func IsForwarded(r *http.Request) bool
- func ParseOrigin(value string) (*url.URL, error)
- func Save(ctx context.Context, db *appstore.DB, config Config) error
- func SaveTx(ctx context.Context, tx *sql.Tx, config Config) error
- type CertificateStatus
- type Certificates
- type Config
- type Policy
Constants ¶
const ( // Local keeps remote exposure disabled. Local = "local" // DirectHTTPS terminates client TLS in MagicHandy. DirectHTTPS = "direct_https" // TrustedProxy accepts HTTPS metadata only from explicitly configured peers. TrustedProxy = "trusted_proxy" )
Variables ¶
This section is empty.
Functions ¶
func HasForwardingHeaders ¶
HasForwardingHeaders also blocks accidental forwarding to local-only routes.
func IsForwarded ¶
IsForwarded preserves the trust boundary independently of a claimed client IP.
func ParseOrigin ¶
ParseOrigin accepts one canonical HTTPS origin, with no credentials or path.
Types ¶
type CertificateStatus ¶
type CertificateStatus struct {
NotBefore time.Time `json:"not_before"`
NotAfter time.Time `json:"not_after"`
Fingerprint string `json:"sha256"`
DNSNames []string `json:"dns_names"`
RenewalDue bool `json:"renewal_due"`
ReloadError bool `json:"reload_error"`
}
CertificateStatus contains public certificate metadata, never file paths/key data.
type Certificates ¶
type Certificates struct {
// contains filtered or unexported fields
}
Certificates retains the last valid chain during a failed file replacement. An expired chain is never offered. Replacements are checked at most every 30s on a handshake; the operator's CA/ACME client owns issuance and file writes.
func LoadCertificates ¶
func LoadCertificates(policy *Policy) (*Certificates, error)
LoadCertificates validates the configured identity before a listener starts.
func (*Certificates) Status ¶
func (c *Certificates) Status() CertificateStatus
Status snapshots certificate metadata without touching key files.
func (*Certificates) TLSConfig ¶
func (c *Certificates) TLSConfig() *tls.Config
TLSConfig returns a TLS 1.2+ configuration with bounded renewal checks.
type Config ¶
type Config struct {
Mode string `json:"mode"`
ListenAddress string `json:"listen_address"`
PublicURL string `json:"public_url"`
TrustedProxies []string `json:"trusted_proxies"`
TLSCertificate string `json:"tls_certificate"`
TLSPrivateKey string `json:"tls_private_key"`
}
Config is persisted separately from live settings: changes apply on restart. Certificate paths belong to the host. Private-key contents never enter JSON.