net

package
v0.11.15 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 5 Imported by: 3 modules, 3 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

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingPort = errors.New("missing port")

Functions

func DetectTLS added in v0.6.1

func DetectTLS(conn net.Conn, host string, timeout time.Duration) bool

DetectTLS attempts to detect TLS on a connection by sending a ClientHello and checking for early TLS fingerprints without performing a full handshake.

It returns true if TLS is detected, false otherwise.

The function uses the following steps: 1. Generate a random 32-byte value for the ClientHello. 2. Create a ServerNameIndication (SNI) extension for the hostname. 3. Create a ClientHello message with the random value and the SNI extension. 4. Send the ClientHello message to the server. 5. Read the response from the server. 6. Check if the response contains a ServerHello or tls alert message. 7. If the response contains a ServerHello or tls alert message, return true. 8. Otherwise, return false.

func TryJoinHostPort

func TryJoinHostPort(host, port string) (string, error)

TryJoinHostPort joins host and port. If port is empty, it returns host and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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