tcpcheck

package
v0.1.79 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: AGPL-3.0 Imports: 20 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 tcpcheck probes bounded TCP targets and distinguishes a Mistgate answer from another listener.

Index

Constants

View Source
const (
	KindHTTPMark = "http_mark"
	KindTLS      = "tls"

	VerdictOurs    = "ours"
	VerdictOther   = "other"
	VerdictRefused = "refused"
	VerdictTimeout = "timeout"
	MaxTargets     = 8
	// MarkSize is the length of a mark's token and of its answer in bytes (Let's Encrypt's token is 32 bytes).
	MarkSize = 32
)

Variables

View Source
var (
	ErrBadParams       = errors.New("tcpcheck: bad parameters")
	ErrUnsupportedHost = errors.New("tcpcheck: unsupported destination")
	ErrNoRoute         = errors.New("tcpcheck: no route")
)

Functions

func MarkBody

func MarkBody(token, answer []byte) []byte

MarkBody is the response body of a mark, shaped like an ACME key authorization: <token>.<base64url of the answer>.

func MarkPath

func MarkPath(token []byte) string

MarkPath is the request path of an HTTP-01 mark: Let's Encrypt's own, with the base64url token.

func Probe

func Probe(ctx context.Context, host string, targets []Target) (family string, verdicts map[uint16]string, err error)

Probe resolves host once, preferring IPv4, then probes each target concurrently. A failed port is a verdict; only invalid input or failure to resolve the destination fails the whole call.

func Validate

func Validate(host string, targets []Target) error

Validate checks the target count, ports, and probe-specific parameters before opening sockets.

Types

type Target

type Target struct {
	Port      uint16
	Kind      string
	SNI       string
	PinSHA256 string
	Token     []byte
	Answer    []byte
}

Jump to

Keyboard shortcuts

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