http

package
Version: v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: BSD-3-Clause Imports: 5 Imported by: 2

Documentation

Overview

Package HTTP defines an interface to send a http.Request from a client to a Vanadium server. This code is Go-specific since it is only used internally by Vanadium.

Index

Constants

This section is empty.

Variables

View Source
var HttpDesc rpc.InterfaceDesc = descHttp

HttpDesc describes the Http interface.

Functions

This section is empty.

Types

type HttpClientMethods

type HttpClientMethods interface {
	// RawDo returns the server's response to req.
	RawDo(_ *context.T, req Request, _ ...rpc.CallOpt) (data []byte, _ error)
}

HttpClientMethods is the client interface containing Http methods.

type HttpClientStub

type HttpClientStub interface {
	HttpClientMethods
}

HttpClientStub embeds HttpClientMethods and is a placeholder for additional management operations.

func HttpClient

func HttpClient(name string) HttpClientStub

HttpClient returns a client stub for Http.

type HttpServerMethods

type HttpServerMethods interface {
	// RawDo returns the server's response to req.
	RawDo(_ *context.T, _ rpc.ServerCall, req Request) (data []byte, _ error)
}

HttpServerMethods is the interface a server writer implements for Http.

type HttpServerStub

type HttpServerStub interface {
	HttpServerStubMethods
	// DescribeInterfaces the Http interfaces.
	Describe__() []rpc.InterfaceDesc
}

HttpServerStub adds universal methods to HttpServerStubMethods.

func HttpServer

func HttpServer(impl HttpServerMethods) HttpServerStub

HttpServer returns a server stub for Http. It converts an implementation of HttpServerMethods into an object that may be used by rpc.Server.

type HttpServerStubMethods

type HttpServerStubMethods HttpServerMethods

HttpServerStubMethods is the server interface containing Http methods, as expected by rpc.Server. There is no difference between this interface and HttpServerMethods since there are no streaming methods.

type Request

type Request struct {
	Method           string
	Url              Url
	Proto            string
	ProtoMajor       int16
	ProtoMinor       int16
	Header           map[string][]string
	Body             []byte
	ContentLength    int64
	TransferEncoding []string
	Close            bool
	Host             string
	Form             map[string][]string
	PostForm         map[string][]string
	Trailer          map[string][]string
	RemoteAddr       string
	RequestUri       string
}

Request represents the http.Request struct. The MultipartForm field is skipped since the docs indicate that it is ignored by clients in favor of the Body field.

func (Request) VDLIsZero

func (x Request) VDLIsZero() bool

func (*Request) VDLRead

func (x *Request) VDLRead(dec vdl.Decoder) error

func (Request) VDLReflect

func (Request) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/http.Request"`
})

func (Request) VDLWrite

func (x Request) VDLWrite(enc vdl.Encoder) error

type Url

type Url struct {
	Scheme   string
	Opaque   string
	Host     string
	Path     string
	RawPath  string
	RawQuery string
	Fragment string
}

Url represents a url.URL struct. The User field is skipped since it is a struct with only unexported fields.

func (Url) VDLIsZero

func (x Url) VDLIsZero() bool

func (*Url) VDLRead

func (x *Url) VDLRead(dec vdl.Decoder) error

func (Url) VDLReflect

func (Url) VDLReflect(struct {
	Name string `vdl:"v.io/v23/services/http.Url"`
})

func (Url) VDLWrite

func (x Url) VDLWrite(enc vdl.Encoder) error

Source Files

Jump to

Keyboard shortcuts

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