tnl

package
v0.1.0-rc.49 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: BSD-3-Clause Imports: 22 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

package tnl publishes an application-owned HTTP handler as an ephemeral service.

Index

Constants

This section is empty.

Variables

View Source
var ErrCertificateUnavailable = publisherservice.ErrCertificateUnavailable
View Source
var ErrPublisherScope = publisheridentity.ErrScope
View Source
var ErrPublisherSelection = publisheridentity.ErrSelection

Functions

This section is empty.

Types

type ExportedCertificate

type ExportedCertificate struct {
	Certificate ServiceCertificate
	ExpiresAt   time.Time
}

func (ExportedCertificate) GoString

func (ExportedCertificate) GoString() string

func (ExportedCertificate) String

func (ExportedCertificate) String() string

type Limits

type Limits struct {
	Requests    int
	Rate        RateLimit
	Concurrency int
}

type Options

type Options struct {
	// Certificate supplies visitor TLS material; nil selects managed issuance.
	// the callback is polled for replacement and must honor cancellation.
	Certificate func(context.Context) (ServiceCertificate, error)
	// NoTelemetry opts this publication out without changing saved preferences.
	NoTelemetry             bool
	RequirePostQuantum      bool
	EnrollmentKey           string
	PublisherIdentityID     string
	PublisherCredentialFile string
	PublisherIdentity       *PublisherIdentity
	ServerURL               string
	StateDir                string
	HTTPClient              *http.Client
	AccessMode              controlv1.VisitorAccessMode
	IP                      []string
	Limits                  Limits
	StateProtection         StateProtection
	// expiresat is an optional fixed service deadline, not a renewable duration.
	ExpiresAt *time.Time
	// Public defaults to true. set it to false for connector-only access.
	Public *bool
}

type PublisherIdentity

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

PublisherIdentity holds one signing identity and selected namespace grant. prepare it once to reuse it across independent ad-hoc invocations.

func PreparePublisherIdentity

func PreparePublisherIdentity(ctx context.Context, options Options) (*PublisherIdentity, error)

PreparePublisherIdentity loads a selected namespace identity using protected local state. it closes the database before returning; Open opens its own certificate state for the duration of each publication.

type RateLimit

type RateLimit struct {
	Requests int
	Per      time.Duration
	Burst    int
}

type ServiceCertificate

type ServiceCertificate struct {
	CertificatePEM []byte
	PrivateKeyPEM  []byte
}

ServiceCertificate contains publisher-held PEM, never target TLS settings. returned buffers transfer to the publication owner and are cleared after use.

func (ServiceCertificate) GoString

func (ServiceCertificate) GoString() string

func (ServiceCertificate) String

func (ServiceCertificate) String() string

type StateProtection

type StateProtection string
const (
	ProtectionFile     StateProtection = "file"
	ProtectionKeychain StateProtection = "keychain"
)

type Tunnel

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

Tunnel owns its local listener, service run, and exact service allocation.

func Open

func Open(ctx context.Context, handler http.Handler, options Options) (*Tunnel, error)

Open binds an HTTP handler and returns after its service is routable. visitors need current permission unless AccessMode is explicitly anonymous.

func (*Tunnel) Close

func (t *Tunnel) Close() error

Close drains publication and removes the exact service. repeated calls are safe.

func (*Tunnel) Endpoint

func (t *Tunnel) Endpoint() controlv1.ServiceEndpoint

Endpoint returns the service hostname, port, and reachability.

func (*Tunnel) ExportCertificate

func (t *Tunnel) ExportCertificate(ctx context.Context) (ExportedCertificate, error)

ExportCertificate copies the current installed certificate and matching key. it does not fetch or renew material. the caller owns the returned buffers.

func (*Tunnel) Service

func (t *Tunnel) Service() controlv1.Service

Service returns a separate snapshot of the allocated ordinary service.

func (*Tunnel) URL

func (t *Tunnel) URL() string

URL returns the public address, or an empty string for a connector-only service.

func (*Tunnel) Wait

func (t *Tunnel) Wait() error

Wait returns when the publish run and its local listener have stopped. exhausting the total request budget is a normal completion.

Jump to

Keyboard shortcuts

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