Documentation
¶
Index ¶
- Constants
- Variables
- func AppendShapePad(out []byte, n int) []byte
- func AuthToken(authKey []byte, window int64, sessionID []byte) string
- func Client(ctx context.Context, cfg *ClientConfig) (net.Conn, error)
- func ClientAuthToken(authKey, sessionID []byte) string
- func DialRTDatagrams(ctx context.Context, cfg *ClientConfig) error
- func EnsureSNICerts(decoyCertDir string)
- func FullFrameEnabled() bool
- func KeepAliveEnabled() bool
- func LearnedSelPub(idPub string) string
- func ListenAndServe(ctx context.Context, cfg *ServerConfig) error
- func MaintainSNICerts(ctx context.Context, decoyCertDir string)
- func NetConnOf(c net.Conn) net.Conn
- func NewSessionCache(capacity int) any
- func ParseDenial(b []byte) (string, bool)
- func ProbeClockDrift(authKey []byte, token string, sessionID []byte) (driftWindows int64, found bool)
- func RememberSelPub(idPub, selPub string)
- func SNICertPaths(decoyCertDir, sni string) (certPath, keyPath string, ok bool)
- func SPKIPin(cert *x509.Certificate) string
- func SetCertIdentity(id *CertIdentity)
- func ShapePadLen(room int) int
- func SharedSessionCache() any
- func SpliceEnabled() bool
- func StartDecoy(ctx context.Context, gate *DecoyGate, cfg *ClientConfig)
- func StreamMuxEnabled() bool
- func VerifyAuthToken(authKey []byte, token string, sessionID []byte) bool
- func WriteDenial(w io.Writer, msg string)
- type AcceptedConn
- type CertIdentity
- type ClientConfig
- type ClonedCertInfo
- type DecoyGate
- type FramedConn
- func (c *FramedConn) Close() error
- func (c *FramedConn) CloseUnderlying() error
- func (c *FramedConn) EndStream() error
- func (c *FramedConn) Read(b []byte) (int, error)
- func (c *FramedConn) Reset()
- func (c *FramedConn) Reusable() bool
- func (c *FramedConn) StreamDone() bool
- func (c *FramedConn) SwitchRaw() error
- func (c *FramedConn) SwitchedRaw() bool
- func (c *FramedConn) Write(b []byte) (int, error)
- type HandshakeResult
- type HandshakeStrategy
- func (h *HandshakeStrategy) Load(path string) error
- func (h *HandshakeStrategy) Observe(ctx string, arm int, r HandshakeResult)
- func (h *HandshakeStrategy) Record(ctx string, r HandshakeResult)
- func (h *HandshakeStrategy) Save(path string) error
- func (h *HandshakeStrategy) Select(ctx string, arms int) int
- func (h *HandshakeStrategy) SelectSplit(ctx string) (offset, arm int)
- type Keys
- type ServerConfig
- type UserEntry
Constants ¶
View Source
const KeepAliveProtoBit byte = 0x20
View Source
const SpliceProtoBit byte = 0x80
Variables ¶
View Source
var ErrSwitchRaw = errors.New("whispera: framed switched to raw")
Functions ¶
func AppendShapePad ¶ added in v0.0.6
func ClientAuthToken ¶
func DialRTDatagrams ¶ added in v0.0.2
func DialRTDatagrams(ctx context.Context, cfg *ClientConfig) error
func EnsureSNICerts ¶ added in v0.0.5
func EnsureSNICerts(decoyCertDir string)
func FullFrameEnabled ¶ added in v0.0.4
func FullFrameEnabled() bool
func KeepAliveEnabled ¶ added in v0.0.5
func KeepAliveEnabled() bool
func LearnedSelPub ¶ added in v0.0.6
func ListenAndServe ¶
func ListenAndServe(ctx context.Context, cfg *ServerConfig) error
func MaintainSNICerts ¶ added in v0.0.6
func NewSessionCache ¶
func ParseDenial ¶ added in v0.0.5
func ProbeClockDrift ¶
func RememberSelPub ¶ added in v0.0.6
func RememberSelPub(idPub, selPub string)
func SNICertPaths ¶
func SPKIPin ¶
func SPKIPin(cert *x509.Certificate) string
func SetCertIdentity ¶
func SetCertIdentity(id *CertIdentity)
func ShapePadLen ¶ added in v0.0.6
func SharedSessionCache ¶
func SharedSessionCache() any
func SpliceEnabled ¶
func SpliceEnabled() bool
func StartDecoy ¶
func StartDecoy(ctx context.Context, gate *DecoyGate, cfg *ClientConfig)
func StreamMuxEnabled ¶ added in v0.0.2
func StreamMuxEnabled() bool
func WriteDenial ¶ added in v0.0.5
Types ¶
type AcceptedConn ¶ added in v0.0.5
type CertIdentity ¶
type CertIdentity struct {
// contains filtered or unexported fields
}
func LoadOrCreateCertIdentity ¶
func LoadOrCreateCertIdentity(path string) (*CertIdentity, error)
func (*CertIdentity) PubB64 ¶
func (id *CertIdentity) PubB64() string
func (*CertIdentity) SelectorKey ¶ added in v0.0.5
func (c *CertIdentity) SelectorKey() (*ecdh.PrivateKey, error)
func (*CertIdentity) SelectorPub ¶ added in v0.0.5
func (c *CertIdentity) SelectorPub() []byte
type ClientConfig ¶
type ClientConfig struct {
ServerAddr string
ServerName string
ServerNames []string
ServerCertPin string
ServerIDPub string
ServerSelPub string
SessionCache any
TCPDialer func(ctx context.Context, network, addr string) (net.Conn, error)
EnableQUIC bool
QUICAddr string
OnQUICConn func(*quicgo.Conn)
HelloSplitOffset int
HelloID utls.ClientHelloID
HelloRaw []byte
OnHandshake func(result HandshakeResult, latency time.Duration)
OnServerSelPub func(selPub string)
OnLiveReset func()
OnLiveOK func()
}
type ClonedCertInfo ¶
type ClonedCertInfo struct {
Subject string
DNSNames []string
NotBefore time.Time
NotAfter time.Time
}
func CloneCertToFiles ¶
func CloneCertToFiles(domain, outCert, outKey string) (*ClonedCertInfo, error)
func RecloneCertToFiles ¶ added in v0.0.6
func RecloneCertToFiles(domain, outCert, outKey string) (*ClonedCertInfo, error)
type DecoyGate ¶
type DecoyGate struct {
// contains filtered or unexported fields
}
func NewDecoyGate ¶
func NewDecoyGate() *DecoyGate
type FramedConn ¶ added in v0.0.5
func NewFramedConn ¶ added in v0.0.5
func NewFramedConn(c net.Conn) *FramedConn
func (*FramedConn) Close ¶ added in v0.0.5
func (c *FramedConn) Close() error
func (*FramedConn) CloseUnderlying ¶ added in v0.0.5
func (c *FramedConn) CloseUnderlying() error
func (*FramedConn) EndStream ¶ added in v0.0.5
func (c *FramedConn) EndStream() error
func (*FramedConn) Reset ¶ added in v0.0.5
func (c *FramedConn) Reset()
func (*FramedConn) Reusable ¶ added in v0.0.5
func (c *FramedConn) Reusable() bool
func (*FramedConn) StreamDone ¶ added in v0.0.5
func (c *FramedConn) StreamDone() bool
func (*FramedConn) SwitchRaw ¶ added in v0.0.6
func (c *FramedConn) SwitchRaw() error
func (*FramedConn) SwitchedRaw ¶ added in v0.0.6
func (c *FramedConn) SwitchedRaw() bool
type HandshakeResult ¶
type HandshakeResult int
const ( HandshakeOK HandshakeResult = iota HandshakeResetFast HandshakeIncomplete HandshakeRejected HandshakeError )
func (HandshakeResult) Reward ¶
func (r HandshakeResult) Reward() float64
type HandshakeStrategy ¶
type HandshakeStrategy struct {
// contains filtered or unexported fields
}
func NewHandshakeStrategy ¶
func NewHandshakeStrategy() *HandshakeStrategy
func (*HandshakeStrategy) Load ¶ added in v0.0.4
func (h *HandshakeStrategy) Load(path string) error
func (*HandshakeStrategy) Observe ¶
func (h *HandshakeStrategy) Observe(ctx string, arm int, r HandshakeResult)
func (*HandshakeStrategy) Record ¶ added in v0.0.4
func (h *HandshakeStrategy) Record(ctx string, r HandshakeResult)
func (*HandshakeStrategy) Save ¶ added in v0.0.4
func (h *HandshakeStrategy) Save(path string) error
func (*HandshakeStrategy) Select ¶ added in v0.0.4
func (h *HandshakeStrategy) Select(ctx string, arms int) int
Select returns the arm (a tactic index into a repertoire of the given size) to use for this context. It holds the current arm while its survival signal is healthy and switches to the best arm on record only once survival drops — adapt when found, not on every dial — but occasionally explores a less-tried arm so every tactic keeps getting measured on real traffic.
func (*HandshakeStrategy) SelectSplit ¶
func (h *HandshakeStrategy) SelectSplit(ctx string) (offset, arm int)
type ServerConfig ¶
type ServerConfig struct {
ListenAddr string
ExtraListenAddrs []string
BackendH2CAddr string
TLSCert string
TLSKey string
Domain string
ACMEDir string
DecoyOrigin string
DecoyCertDir string
AsymBiasRatio float64
QUICListenAddr string
ExtraQUICListenAddrs []string
GetUsers func() []UserEntry
UsersVersion func() uint64
OnConn func(AcceptedConn)
// contains filtered or unexported fields
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.