Documentation ¶
Overview ¶
Package dial contains an implementation of TCP/HTTP dialing.
Index ¶
- Constants
- func HTTP[T any](ctx context.Context, opts Opts, url, protocol string, ...) (*T, error)
- func HTTPHandler(s ProtocolServer, proto string) http.Handler
- func TCP(ctx context.Context, opts Opts) (net.Conn, error)
- func TLS(conn net.Conn, opts Opts) *tls.Conn
- func WithTLS(ctx context.Context, opts Opts) (net.Conn, error)
- type Opts
- type ProtocolServer
Constants ¶
View Source
const ( DefaultConnectTimeout = time.Second * 30 DefaultEstablishTimeout = time.Second * 15 )
Variables ¶
This section is empty.
Functions ¶
func HTTPHandler ¶
func HTTPHandler(s ProtocolServer, proto string) http.Handler
Types ¶
type Opts ¶
type Opts struct { Domain string // If non-empty, overrides DNS lookup from Domain Addrs []netip.Addr // If not set, will use 80 for not TLS, and 443 for TLS Port uint16 // Establish the connection with TLS, turns HTTP into HTTPS. TLS bool // If non-empty, sends this string in SNI, and checks the certificate common name against it. // // Only works if TLS is true. ExpectCertCN string // If nil, uses default of 30 seconds ConnectTimeout time.Duration // If nil, uses default of 15 seconds EstablishTimeout time.Duration }
func (*Opts) SetDefaults ¶
func (opts *Opts) SetDefaults()
Click to show internal directories.
Click to hide internal directories.