net

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 5 Imported by: 1

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