http

package
v0.0.0-...-874b49b Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 20 Imported by: 3

Documentation

Overview

Package http implements FDO transport interfaces using an HTTP protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationJar

type AuthorizationJar interface {
	Clear(context.Context, protocol.Protocol)
	GetToken(context.Context, protocol.Protocol) string
	StoreToken(context.Context, protocol.Protocol, string)
}

AuthorizationJar stores authorization tokens. Context parameters are used to allow passing arbitrary data which may be needed for thread-safe implementations.

type Handler

type Handler struct {
	Tokens protocol.TokenService

	DIResponder  protocol.Responder
	TO0Responder protocol.Responder
	TO1Responder protocol.Responder
	TO2Responder protocol.Responder

	// MaxContentLength defaults to 65535. Negative values disable content
	// length checking.
	MaxContentLength int64
}

Handler implements http.Handler and responds to all DI, TO1, and TO2 message types. It is expected that the request will use the POST method and the path will be of the form "/fdo/$VER/msg/$MSG".

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Transport

type Transport struct {
	// The http/https URL, potentially including a path prefix, but without
	// /fdo/101/msg.
	BaseURL string

	// Client to use for HTTP requests. Nil indicates that the default client
	// should be used.
	Client *http.Client

	// Auth stores Authorization headers much like a CookieJar in a standard
	// *http.Client stores cookie headers. As specified in Section 4.3, each
	// protocol (TO1, TO2, etc.) generally starts with a message containing no
	// Authorization header and the server responds with one. This header, like
	// a cookie, is used for tracking protocol state on the server side.
	//
	// If no jar is set, then a default jar will be used. The default jar
	// stores tokens based on DI/TO1/TO2 protocol classification of the request
	// message type.
	Auth AuthorizationJar

	// MaxContentLength defaults to 65535. Negative values disable content
	// length checking.
	MaxContentLength int64
}

Transport implements FDO message sending capabilities over HTTP. Send may be used for sending one message and receiving one response message.

func (*Transport) Send

func (t *Transport) Send(ctx context.Context, msgType uint8, msg any, sess kex.Session) (respType uint8, _ io.ReadCloser, _ error)

Send sends a single message and receives a single response message.

Directories

Path Synopsis
internal
httputil
Package httputil implements APIs misssing from the TinyGo stdlib.
Package httputil implements APIs misssing from the TinyGo stdlib.

Jump to

Keyboard shortcuts

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