tls

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const TypeTLS protocol.Type = 13

Variables

This section is empty.

Functions

func NewState

func NewState(c protocol.Context) any

func Protocol

func Protocol() protocol.Payload

Types

type BuffConn

type BuffConn struct {
	// contains filtered or unexported fields
}

func NewBuffConn

func NewBuffConn(initialData []byte, ctx context.Context, cctx protocol.Context) *BuffConn

func (BuffConn) Close

func (conn BuffConn) Close() error

func (BuffConn) LocalAddr

func (conn BuffConn) LocalAddr() net.Addr

func (BuffConn) NeedsMoreData

func (conn BuffConn) NeedsMoreData() bool

func (BuffConn) OutboundData

func (conn BuffConn) OutboundData() []byte

func (*BuffConn) Read

func (conn *BuffConn) Read(p []byte) (int, error)

func (BuffConn) RemoteAddr

func (conn BuffConn) RemoteAddr() net.Addr

func (BuffConn) SetDeadline

func (conn BuffConn) SetDeadline(t time.Time) error

func (*BuffConn) SetExpectedWriterByteCount added in v0.1.1

func (conn *BuffConn) SetExpectedWriterByteCount(total int, initialReceived int)

func (BuffConn) SetReadDeadline

func (conn BuffConn) SetReadDeadline(t time.Time) error

func (BuffConn) SetWriteDeadline

func (conn BuffConn) SetWriteDeadline(t time.Time) error

func (*BuffConn) UpdateData

func (conn *BuffConn) UpdateData(data []byte)

func (BuffConn) Write

func (conn BuffConn) Write(p []byte) (int, error)

type Flag

type Flag byte
const (
	FlagLengthIncluded Flag = 1 << 7
	FlagMoreFragments  Flag = 1 << 6
	FlagTLSStart       Flag = 1 << 5
	FlagNone           Flag = 0
)

type Payload

type Payload struct {
	Flags  Flag
	Length uint32
	Data   []byte

	Inner protocol.Payload
	// contains filtered or unexported fields
}

func (*Payload) Decode

func (p *Payload) Decode(raw []byte) error

func (*Payload) Encode

func (p *Payload) Encode() ([]byte, error)

func (*Payload) Handle

func (p *Payload) Handle(ctx protocol.Context) protocol.Payload

func (*Payload) HasInner

func (p *Payload) HasInner() protocol.Payload

func (*Payload) ModifyRADIUSResponse

func (p *Payload) ModifyRADIUSResponse(r *radius.Packet, q *radius.Packet) error

func (*Payload) Offerable

func (p *Payload) Offerable() bool

func (*Payload) String

func (p *Payload) String() string

func (*Payload) Type

func (p *Payload) Type() protocol.Type

type Settings

type Settings struct {
	Config *tls.Config
	// VerifyPeerCertificate mirrors tls.Config.VerifyPeerCertificate while adding
	// protocol.Context. Note that Go does not invoke this callback on resumed
	// connections.
	VerifyPeerCertificate func(ctx protocol.Context, rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
	// VerifyConnection mirrors tls.Config.VerifyConnection while adding
	// protocol.Context. Prefer this hook for production-critical validation that
	// must also run on resumed connections.
	VerifyConnection func(ctx protocol.Context, cs tls.ConnectionState) error
	// HandshakeSuccessful runs after the TLS handshake has completed and the EAP
	// layer is ready to decide whether the authenticated client should proceed.
	HandshakeSuccessful func(ctx protocol.Context, certs []*x509.Certificate) protocol.Status
}

Settings defines the reusable TLS extension points for EAP-TLS/PEAP consumers.

Consumers that only need native Go TLS client-certificate enforcement can keep Config.ClientAuth at tls.RequireAndVerifyClientCert and leave the hooks nil.

Consumers that need identity-aware inspection or application-specific policy decisions during the handshake can instead require certificate presence (typically tls.RequireAnyClientCert) and perform their own validation in VerifyConnection. That hook runs for all connections, including resumptions.

func (Settings) TLSConfig

func (s Settings) TLSConfig() *tls.Config

type State

type State struct {
	RemainingChunks             [][]byte
	HandshakeDone               bool
	FinalStatus                 protocol.Status
	ClientHello                 *tls.ClientHelloInfo
	MPPEKey                     []byte
	TotalPayloadSize            int
	IncludeLengthInNextFragment bool
	TLS                         *tls.Conn
	Conn                        *BuffConn
	Context                     context.Context
	ContextCancel               context.CancelFunc
	HandshakeCtx                protocol.Context
	Logger                      protocol.Logger
	// contains filtered or unexported fields
}

func (*State) FinalStatusValue added in v0.1.4

func (s *State) FinalStatusValue() protocol.Status

func (*State) HandshakeDoneValue added in v0.1.4

func (s *State) HandshakeDoneValue() bool

func (*State) HasMore

func (s *State) HasMore() bool

func (*State) SetFinalStatus added in v0.1.4

func (s *State) SetFinalStatus(status protocol.Status)

func (*State) SetHandshakeDone added in v0.1.4

func (s *State) SetHandshakeDone(done bool)

type TLSConfig

type TLSConfig interface {
	TLSConfig() *tls.Config
}

Jump to

Keyboard shortcuts

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