Documentation
¶
Overview ¶
Package protocol reaches the point where a TLS ClientHello can be sent: directly for TLS-wrapped services, or after a plaintext STARTTLS-style negotiation (SMTP, IMAP, POP3, FTP, LDAP, XMPP, PostgreSQL, MySQL). New protocols are added by implementing Adapter and registering it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotSupported = errors.New("server does not support TLS upgrade")
ErrNotSupported means the server does not offer TLS for this protocol.
Functions ¶
func DefaultPort ¶
DefaultPort returns the usual port for a protocol (443 for unknown).
Types ¶
type Adapter ¶
type Adapter interface {
// Name is the --protocol value, e.g. "smtp".
Name() string
// STARTTLS reports whether a plaintext negotiation precedes TLS.
STARTTLS() bool
// Upgrade negotiates TLS on s. On return the next bytes written must be
// the ClientHello. Direct-TLS adapters do nothing.
Upgrade(ctx context.Context, s *Session, host string) error
}
Adapter performs a protocol-specific TLS upgrade on a fresh connection.
type Detection ¶
type Detection struct {
Protocol string `json:"protocol"`
Method string `json:"method"` // direct or starttls
Via string `json:"detected_by"` // flag, port, banner, default
Banner string `json:"banner,omitempty"`
}
Detection records how the protocol was chosen.
type Session ¶
Session wraps a connection during negotiation and keeps a transcript.
Click to show internal directories.
Click to hide internal directories.