Documentation
¶
Overview ¶
Package wsheader encodes and validates WireHop WebSocket admission headers.
Index ¶
- Constants
- Variables
- func Headers(request Create) (http.Header, error)
- func JoinHeaders(request Join) (http.Header, error)
- func ParseRejection(headers http.Header) (protocol.ServerHello, error)
- func SetRejection(headers http.Header, rejection protocol.ServerHello) error
- func SignJoin(request *Join, secret protocol.SessionSecret) error
- func ValidateBearerToken(token string) error
- func VerifyJoin(request Join, secret protocol.SessionSecret) error
- type Create
- type Join
Constants ¶
View Source
const ( // Subprotocol is the WebSocket subprotocol for wire protocol version one. Subprotocol = "wirehop.v1" // MaxPathSize leaves room for bounded admission fields within the direct server's request-header budget. MaxPathSize = 8 * 1024 )
Variables ¶
View Source
var ( // ErrInvalid indicates missing, duplicated, malformed, or inconsistent admission headers. ErrInvalid = errors.New("invalid WebSocket admission headers") )
Functions ¶
func JoinHeaders ¶
JoinHeaders returns canonical HTTP headers for an already signed join.
func ParseRejection ¶
func ParseRejection(headers http.Header) (protocol.ServerHello, error)
ParseRejection decodes one canonical rejection from headers.
func SetRejection ¶
func SetRejection(headers http.Header, rejection protocol.ServerHello) error
SetRejection encodes rejection into headers.
func SignJoin ¶
func SignJoin(request *Join, secret protocol.SessionSecret) error
SignJoin validates request and authenticates its canonical encoding.
func ValidateBearerToken ¶
ValidateBearerToken verifies the RFC 6750 b64token character grammar used by session creation.
func VerifyJoin ¶
func VerifyJoin(request Join, secret protocol.SessionSecret) error
VerifyJoin verifies request against the ephemeral session secret.
Types ¶
type Create ¶
type Create struct {
Token string
Target target.Endpoint
LaneID protocol.LaneID
Generation uint64
PathGroupID protocol.PathGroupID
Nonce protocol.Nonce
UnixSeconds int64
MonotonicMicros uint64
}
Create is one WebSocket session-creation request.
func ParseCreate ¶
ParseCreate parses the required creation headers from request.
Click to show internal directories.
Click to hide internal directories.