http

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

HTTP Gateway Protocol

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRequestHash

func CalculateRequestHash(r *Request, reqCert *certexp.CertificateExpressionRequestCertification) ([32]byte, error)

func CalculateResponseHash

func CalculateResponseHash(r *Response, respCert certexp.CertificateExpressionResponseCertification) ([32]byte, error)

Types

type Agent

type Agent struct {
	*agent.Agent
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent(canisterId principal.Principal, cfg agent.Config) (*Agent, error)

func (*Agent) EnableLegacyMode

func (a *Agent) EnableLegacyMode()

func (Agent) HttpRequest

func (a Agent) HttpRequest(request Request) (*Response, error)

func (Agent) HttpRequestStreamingCallback

func (a Agent) HttpRequestStreamingCallback(token StreamingCallbackToken) (**StreamingCallbackHttpResponse, error)

func (Agent) VerifyResponse

func (a Agent) VerifyResponse(path string, req *Request, resp *Response) error

type CertificateHeader

type CertificateHeader struct {
	Certificate certification.Certificate
	Tree        hashtree.HashTree
	Version     int
	ExprPath    []hashtree.Label
}

func ParseCertificateHeader

func ParseCertificateHeader(header string) (*CertificateHeader, error)

type ExpressionPath

type ExpressionPath struct {
	Wildcard bool
	Path     []hashtree.Label
}

func ParseExpressionPath

func ParseExpressionPath(path []hashtree.Label) (*ExpressionPath, error)

func (ExpressionPath) GetPath

func (e ExpressionPath) GetPath() []hashtree.Label

type HeaderField

type HeaderField struct {
	Field0 string `ic:"0"`
	Field1 string `ic:"1"`
}

type Key

type Key = string

type Request

type Request struct {
	Method             string        `ic:"method"`
	Url                string        `ic:"url"`
	Headers            []HeaderField `ic:"headers"`
	Body               []byte        `ic:"body"`
	CertificateVersion *uint16       `ic:"certificate_version,omitempty"`
}

type Response

type Response struct {
	StatusCode        uint16             `ic:"status_code"`
	Headers           []HeaderField      `ic:"headers"`
	Body              []byte             `ic:"body"`
	Upgrade           *bool              `ic:"upgrade,omitempty"`
	StreamingStrategy *StreamingStrategy `ic:"streaming_strategy,omitempty"`
}

type StreamingCallbackHttpResponse

type StreamingCallbackHttpResponse struct {
	Body  []byte                  `ic:"body"`
	Token *StreamingCallbackToken `ic:"token,omitempty"`
}

type StreamingCallbackToken

type StreamingCallbackToken struct {
	Key             Key     `ic:"key"`
	ContentEncoding string  `ic:"content_encoding"`
	Index           idl.Nat `ic:"index"`
	Sha256          *[]byte `ic:"sha256,omitempty"`
}

type StreamingStrategy

type StreamingStrategy struct {
	Callback *struct {
		Callback struct {
		} `ic:"callback"`
		Token StreamingCallbackToken `ic:"token"`
	} `ic:"Callback,variant"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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