http

package
v1.9.8 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_http_http_proto protoreflect.FileDescriptor
View Source
var HTTP_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "http.HTTP",
	HandlerType: (*HTTPServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Handle",
			Handler:    _HTTP_Handle_Handler,
		},
		{
			MethodName: "HandleSimple",
			Handler:    _HTTP_HandleSimple_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "http/http.proto",
}

HTTP_ServiceDesc is the grpc.ServiceDesc for HTTP service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterHTTPServer

func RegisterHTTPServer(s grpc.ServiceRegistrar, srv HTTPServer)

Types

type Certificates

type Certificates struct {

	// cert is the certificate body
	Cert [][]byte `protobuf:"bytes,1,rep,name=cert,proto3" json:"cert,omitempty"`
	// contains filtered or unexported fields
}

func (*Certificates) Descriptor deprecated

func (*Certificates) Descriptor() ([]byte, []int)

Deprecated: Use Certificates.ProtoReflect.Descriptor instead.

func (*Certificates) GetCert

func (x *Certificates) GetCert() [][]byte

func (*Certificates) ProtoMessage

func (*Certificates) ProtoMessage()

func (*Certificates) ProtoReflect

func (x *Certificates) ProtoReflect() protoreflect.Message

func (*Certificates) Reset

func (x *Certificates) Reset()

func (*Certificates) String

func (x *Certificates) String() string

type ConnectionState

type ConnectionState struct {

	// version is the TLS version used by the connection (e.g. VersionTLS12)
	Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	// handshake_complete is true if the handshake has concluded
	HandshakeComplete bool `protobuf:"varint,2,opt,name=handshake_complete,json=handshakeComplete,proto3" json:"handshake_complete,omitempty"`
	// did_resume is true if this connection was successfully resumed from a
	// previous session with a session ticket or similar mechanism
	DidResume bool `protobuf:"varint,3,opt,name=did_resume,json=didResume,proto3" json:"did_resume,omitempty"`
	// cipher_suite is the cipher suite negotiated for the connection
	CipherSuite uint32 `protobuf:"varint,4,opt,name=cipher_suite,json=cipherSuite,proto3" json:"cipher_suite,omitempty"`
	// negotiated_protocol is the application protocol negotiated with ALPN
	NegotiatedProtocol string `protobuf:"bytes,5,opt,name=negotiated_protocol,json=negotiatedProtocol,proto3" json:"negotiated_protocol,omitempty"`
	// server_name is the value of the Server Name Indication extension sent by
	// the client
	ServerName string `protobuf:"bytes,6,opt,name=server_name,json=serverName,proto3" json:"server_name,omitempty"`
	// peer_certificates are the parsed certificates sent by the peer, in the
	// order in which they were sent
	PeerCertificates *Certificates `protobuf:"bytes,7,opt,name=peer_certificates,json=peerCertificates,proto3" json:"peer_certificates,omitempty"`
	// verified_chains is a list of one or more chains where the first element is
	// PeerCertificates[0] and the last element is from Config.RootCAs (on the
	// client side) or Config.ClientCAs (on the server side).
	VerifiedChains []*Certificates `protobuf:"bytes,8,rep,name=verified_chains,json=verifiedChains,proto3" json:"verified_chains,omitempty"`
	// signed_certificate_timestamps is a list of SCTs provided by the peer
	// through the TLS handshake for the leaf certificate, if any
	SignedCertificateTimestamps [][]byte `` /* 144-byte string literal not displayed */
	// ocsp_response is a stapled Online Certificate Status Protocol (OCSP)
	// response provided by the peer for the leaf certificate, if any.
	OcspResponse []byte `protobuf:"bytes,10,opt,name=ocsp_response,json=ocspResponse,proto3" json:"ocsp_response,omitempty"`
	// contains filtered or unexported fields
}

ConnectionState is tls.ConnectionState see: https://pkg.go.dev/crypto/tls#ConnectionState

func (*ConnectionState) Descriptor deprecated

func (*ConnectionState) Descriptor() ([]byte, []int)

Deprecated: Use ConnectionState.ProtoReflect.Descriptor instead.

func (*ConnectionState) GetCipherSuite

func (x *ConnectionState) GetCipherSuite() uint32

func (*ConnectionState) GetDidResume

func (x *ConnectionState) GetDidResume() bool

func (*ConnectionState) GetHandshakeComplete

func (x *ConnectionState) GetHandshakeComplete() bool

func (*ConnectionState) GetNegotiatedProtocol

func (x *ConnectionState) GetNegotiatedProtocol() string

func (*ConnectionState) GetOcspResponse

func (x *ConnectionState) GetOcspResponse() []byte

func (*ConnectionState) GetPeerCertificates

func (x *ConnectionState) GetPeerCertificates() *Certificates

func (*ConnectionState) GetServerName

func (x *ConnectionState) GetServerName() string

func (*ConnectionState) GetSignedCertificateTimestamps

func (x *ConnectionState) GetSignedCertificateTimestamps() [][]byte

func (*ConnectionState) GetVerifiedChains

func (x *ConnectionState) GetVerifiedChains() []*Certificates

func (*ConnectionState) GetVersion

func (x *ConnectionState) GetVersion() uint32

func (*ConnectionState) ProtoMessage

func (*ConnectionState) ProtoMessage()

func (*ConnectionState) ProtoReflect

func (x *ConnectionState) ProtoReflect() protoreflect.Message

func (*ConnectionState) Reset

func (x *ConnectionState) Reset()

func (*ConnectionState) String

func (x *ConnectionState) String() string

type Element

type Element struct {

	// key is a element key in a key value pair
	Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// values are a list of strings coresponding to the key
	Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

func (*Element) Descriptor deprecated

func (*Element) Descriptor() ([]byte, []int)

Deprecated: Use Element.ProtoReflect.Descriptor instead.

func (*Element) GetKey

func (x *Element) GetKey() string

func (*Element) GetValues

func (x *Element) GetValues() []string

func (*Element) ProtoMessage

func (*Element) ProtoMessage()

func (*Element) ProtoReflect

func (x *Element) ProtoReflect() protoreflect.Message

func (*Element) Reset

func (x *Element) Reset()

func (*Element) String

func (x *Element) String() string

type HTTPClient

type HTTPClient interface {
	// Handle wraps http1 over http2 and provides support for websockets by implementing
	// net conn and responsewriter in http2.
	Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// HandleSimple wraps http1 requests over http2 similar to Handle but only passes headers
	// and body bytes. Because the request and response are single protos with no inline
	// gRPC servers the CPU cost as well as file descriptor overhead is less
	// (no additional goroutines).
	HandleSimple(ctx context.Context, in *HandleSimpleHTTPRequest, opts ...grpc.CallOption) (*HandleSimpleHTTPResponse, error)
}

HTTPClient is the client API for HTTP service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewHTTPClient

func NewHTTPClient(cc grpc.ClientConnInterface) HTTPClient

type HTTPRequest

type HTTPRequest struct {

	// response_writer is used by an HTTP handler to construct an HTTP response
	ResponseWriter *ResponseWriter `protobuf:"bytes,1,opt,name=response_writer,json=responseWriter,proto3" json:"response_writer,omitempty"`
	// request is an http request
	Request *Request `protobuf:"bytes,2,opt,name=request,proto3" json:"request,omitempty"`
	// contains filtered or unexported fields
}

func (*HTTPRequest) Descriptor deprecated

func (*HTTPRequest) Descriptor() ([]byte, []int)

Deprecated: Use HTTPRequest.ProtoReflect.Descriptor instead.

func (*HTTPRequest) GetRequest

func (x *HTTPRequest) GetRequest() *Request

func (*HTTPRequest) GetResponseWriter

func (x *HTTPRequest) GetResponseWriter() *ResponseWriter

func (*HTTPRequest) ProtoMessage

func (*HTTPRequest) ProtoMessage()

func (*HTTPRequest) ProtoReflect

func (x *HTTPRequest) ProtoReflect() protoreflect.Message

func (*HTTPRequest) Reset

func (x *HTTPRequest) Reset()

func (*HTTPRequest) String

func (x *HTTPRequest) String() string

type HTTPServer

type HTTPServer interface {
	// Handle wraps http1 over http2 and provides support for websockets by implementing
	// net conn and responsewriter in http2.
	Handle(context.Context, *HTTPRequest) (*emptypb.Empty, error)
	// HandleSimple wraps http1 requests over http2 similar to Handle but only passes headers
	// and body bytes. Because the request and response are single protos with no inline
	// gRPC servers the CPU cost as well as file descriptor overhead is less
	// (no additional goroutines).
	HandleSimple(context.Context, *HandleSimpleHTTPRequest) (*HandleSimpleHTTPResponse, error)
	// contains filtered or unexported methods
}

HTTPServer is the server API for HTTP service. All implementations must embed UnimplementedHTTPServer for forward compatibility

type HandleSimpleHTTPRequest

type HandleSimpleHTTPRequest struct {

	// method specifies the HTTP method (GET, POST, PUT, etc.)
	Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	// url specifies either the URI being requested
	Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// headers contains the request header fields either received
	// by the server or to be sent by the client
	Headers []*Element `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"`
	// body is the request payload in bytes
	Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleSimpleHTTPRequest) Descriptor deprecated

func (*HandleSimpleHTTPRequest) Descriptor() ([]byte, []int)

Deprecated: Use HandleSimpleHTTPRequest.ProtoReflect.Descriptor instead.

func (*HandleSimpleHTTPRequest) GetBody

func (x *HandleSimpleHTTPRequest) GetBody() []byte

func (*HandleSimpleHTTPRequest) GetHeaders

func (x *HandleSimpleHTTPRequest) GetHeaders() []*Element

func (*HandleSimpleHTTPRequest) GetMethod

func (x *HandleSimpleHTTPRequest) GetMethod() string

func (*HandleSimpleHTTPRequest) GetUrl

func (x *HandleSimpleHTTPRequest) GetUrl() string

func (*HandleSimpleHTTPRequest) ProtoMessage

func (*HandleSimpleHTTPRequest) ProtoMessage()

func (*HandleSimpleHTTPRequest) ProtoReflect

func (x *HandleSimpleHTTPRequest) ProtoReflect() protoreflect.Message

func (*HandleSimpleHTTPRequest) Reset

func (x *HandleSimpleHTTPRequest) Reset()

func (*HandleSimpleHTTPRequest) String

func (x *HandleSimpleHTTPRequest) String() string

type HandleSimpleHTTPResponse

type HandleSimpleHTTPResponse struct {

	// code is the response code
	Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	// headers contains the request header fields either received
	// by the server or to be sent by the client
	Headers []*Element `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"`
	// body is the response payload in bytes
	Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*HandleSimpleHTTPResponse) Descriptor deprecated

func (*HandleSimpleHTTPResponse) Descriptor() ([]byte, []int)

Deprecated: Use HandleSimpleHTTPResponse.ProtoReflect.Descriptor instead.

func (*HandleSimpleHTTPResponse) GetBody

func (x *HandleSimpleHTTPResponse) GetBody() []byte

func (*HandleSimpleHTTPResponse) GetCode

func (x *HandleSimpleHTTPResponse) GetCode() int32

func (*HandleSimpleHTTPResponse) GetHeaders

func (x *HandleSimpleHTTPResponse) GetHeaders() []*Element

func (*HandleSimpleHTTPResponse) ProtoMessage

func (*HandleSimpleHTTPResponse) ProtoMessage()

func (*HandleSimpleHTTPResponse) ProtoReflect

func (x *HandleSimpleHTTPResponse) ProtoReflect() protoreflect.Message

func (*HandleSimpleHTTPResponse) Reset

func (x *HandleSimpleHTTPResponse) Reset()

func (*HandleSimpleHTTPResponse) String

func (x *HandleSimpleHTTPResponse) String() string

type Request

type Request struct {

	// method specifies the HTTP method (GET, POST, PUT, etc.)
	Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	// url specifies either the URI being requested (for server requests)
	// or the URL to access (for client requests)
	Url *URL `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// proto is the protocol version for incoming server requests
	Proto string `protobuf:"bytes,3,opt,name=proto,proto3" json:"proto,omitempty"`
	// proto_major is the major version
	ProtoMajor int32 `protobuf:"varint,4,opt,name=proto_major,json=protoMajor,proto3" json:"proto_major,omitempty"`
	// proto_minor is the minor version
	ProtoMinor int32 `protobuf:"varint,5,opt,name=proto_minor,json=protoMinor,proto3" json:"proto_minor,omitempty"`
	// header contains the request header fields either received
	// by the server or to be sent by the client
	Header []*Element `protobuf:"bytes,6,rep,name=header,proto3" json:"header,omitempty"`
	// body is the request payload in bytes
	Body []byte `protobuf:"bytes,7,opt,name=body,proto3" json:"body,omitempty"`
	// content_length records the length of the associated content
	ContentLength int64 `protobuf:"varint,8,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
	// transfer_encoding lists the transfer encodings from outermost to
	// innermost
	TransferEncoding []string `protobuf:"bytes,9,rep,name=transfer_encoding,json=transferEncoding,proto3" json:"transfer_encoding,omitempty"`
	// host specifies the host on which the URL is sought
	Host string `protobuf:"bytes,10,opt,name=host,proto3" json:"host,omitempty"`
	// form contains the parsed form data, including both the URL
	// field's query parameters and the PATCH, POST, or PUT form data
	Form []*Element `protobuf:"bytes,11,rep,name=form,proto3" json:"form,omitempty"`
	// post_form contains the parsed form data from PATCH, POST
	// or PUT body parameters
	PostForm []*Element `protobuf:"bytes,12,rep,name=post_form,json=postForm,proto3" json:"post_form,omitempty"`
	// trailer_keys specifies additional headers that are sent after the request
	TrailerKeys []string `protobuf:"bytes,13,rep,name=trailer_keys,json=trailerKeys,proto3" json:"trailer_keys,omitempty"`
	// remote_addr allows HTTP servers and other software to record
	// the network address that sent the request
	RemoteAddr string `protobuf:"bytes,14,opt,name=remote_addr,json=remoteAddr,proto3" json:"remote_addr,omitempty"`
	// request_uri is the unmodified request-target
	RequestUri string `protobuf:"bytes,15,opt,name=request_uri,json=requestUri,proto3" json:"request_uri,omitempty"`
	// tls connection state
	Tls *ConnectionState `protobuf:"bytes,16,opt,name=tls,proto3" json:"tls,omitempty"`
	// contains filtered or unexported fields
}

Request is an http.Request see: https://pkg.go.dev/net/http#Request

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetBody

func (x *Request) GetBody() []byte

func (*Request) GetContentLength

func (x *Request) GetContentLength() int64

func (*Request) GetForm

func (x *Request) GetForm() []*Element

func (*Request) GetHeader

func (x *Request) GetHeader() []*Element

func (*Request) GetHost

func (x *Request) GetHost() string

func (*Request) GetMethod

func (x *Request) GetMethod() string

func (*Request) GetPostForm

func (x *Request) GetPostForm() []*Element

func (*Request) GetProto

func (x *Request) GetProto() string

func (*Request) GetProtoMajor

func (x *Request) GetProtoMajor() int32

func (*Request) GetProtoMinor

func (x *Request) GetProtoMinor() int32

func (*Request) GetRemoteAddr

func (x *Request) GetRemoteAddr() string

func (*Request) GetRequestUri

func (x *Request) GetRequestUri() string

func (*Request) GetTls

func (x *Request) GetTls() *ConnectionState

func (*Request) GetTrailerKeys

func (x *Request) GetTrailerKeys() []string

func (*Request) GetTransferEncoding

func (x *Request) GetTransferEncoding() []string

func (*Request) GetUrl

func (x *Request) GetUrl() *URL

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type ResponseWriter

type ResponseWriter struct {

	// header returns the header map that will be sent by
	// WriteHeader.
	Header []*Element `protobuf:"bytes,1,rep,name=header,proto3" json:"header,omitempty"`
	// server_addr is the address of the gRPC server hosting the Writer service
	ServerAddr string `protobuf:"bytes,2,opt,name=server_addr,json=serverAddr,proto3" json:"server_addr,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseWriter) Descriptor deprecated

func (*ResponseWriter) Descriptor() ([]byte, []int)

Deprecated: Use ResponseWriter.ProtoReflect.Descriptor instead.

func (*ResponseWriter) GetHeader

func (x *ResponseWriter) GetHeader() []*Element

func (*ResponseWriter) GetServerAddr

func (x *ResponseWriter) GetServerAddr() string

func (*ResponseWriter) ProtoMessage

func (*ResponseWriter) ProtoMessage()

func (*ResponseWriter) ProtoReflect

func (x *ResponseWriter) ProtoReflect() protoreflect.Message

func (*ResponseWriter) Reset

func (x *ResponseWriter) Reset()

func (*ResponseWriter) String

func (x *ResponseWriter) String() string

type URL

type URL struct {

	// scheme is the url scheme name
	Scheme string `protobuf:"bytes,1,opt,name=scheme,proto3" json:"scheme,omitempty"`
	// opaque is encoded opaque data
	Opaque string `protobuf:"bytes,2,opt,name=opaque,proto3" json:"opaque,omitempty"`
	// user is username and password information
	User *Userinfo `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"`
	// host can be in the format host or host:port
	Host string `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
	// path (relative paths may omit leading slash)
	Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	// raw_path is encoded path hint (see EscapedPath method)
	RawPath string `protobuf:"bytes,6,opt,name=raw_path,json=rawPath,proto3" json:"raw_path,omitempty"`
	// force is append a query ('?') even if RawQuery is empty
	ForceQuery bool `protobuf:"varint,7,opt,name=force_query,json=forceQuery,proto3" json:"force_query,omitempty"`
	// raw_query is encoded query values, without '?'
	RawQuery string `protobuf:"bytes,8,opt,name=raw_query,json=rawQuery,proto3" json:"raw_query,omitempty"`
	// fragment is fragment for references, without '#'
	Fragment string `protobuf:"bytes,9,opt,name=fragment,proto3" json:"fragment,omitempty"`
	// contains filtered or unexported fields
}

URL is a net.URL see: https://pkg.go.dev/net/url#URL

func (*URL) Descriptor deprecated

func (*URL) Descriptor() ([]byte, []int)

Deprecated: Use URL.ProtoReflect.Descriptor instead.

func (*URL) GetForceQuery

func (x *URL) GetForceQuery() bool

func (*URL) GetFragment

func (x *URL) GetFragment() string

func (*URL) GetHost

func (x *URL) GetHost() string

func (*URL) GetOpaque

func (x *URL) GetOpaque() string

func (*URL) GetPath

func (x *URL) GetPath() string

func (*URL) GetRawPath

func (x *URL) GetRawPath() string

func (*URL) GetRawQuery

func (x *URL) GetRawQuery() string

func (*URL) GetScheme

func (x *URL) GetScheme() string

func (*URL) GetUser

func (x *URL) GetUser() *Userinfo

func (*URL) ProtoMessage

func (*URL) ProtoMessage()

func (*URL) ProtoReflect

func (x *URL) ProtoReflect() protoreflect.Message

func (*URL) Reset

func (x *URL) Reset()

func (*URL) String

func (x *URL) String() string

type UnimplementedHTTPServer

type UnimplementedHTTPServer struct {
}

UnimplementedHTTPServer must be embedded to have forward compatible implementations.

func (UnimplementedHTTPServer) Handle

type UnsafeHTTPServer

type UnsafeHTTPServer interface {
	// contains filtered or unexported methods
}

UnsafeHTTPServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HTTPServer will result in compilation errors.

type Userinfo

type Userinfo struct {

	// username is the username for the user
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// password is the password for the user
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// password_set is a boolean which is true if the passord is set
	PasswordSet bool `protobuf:"varint,3,opt,name=password_set,json=passwordSet,proto3" json:"password_set,omitempty"`
	// contains filtered or unexported fields
}

UserInfo is net.Userinfo see: https://pkg.go.dev/net/url#Userinfo

func (*Userinfo) Descriptor deprecated

func (*Userinfo) Descriptor() ([]byte, []int)

Deprecated: Use Userinfo.ProtoReflect.Descriptor instead.

func (*Userinfo) GetPassword

func (x *Userinfo) GetPassword() string

func (*Userinfo) GetPasswordSet

func (x *Userinfo) GetPasswordSet() bool

func (*Userinfo) GetUsername

func (x *Userinfo) GetUsername() string

func (*Userinfo) ProtoMessage

func (*Userinfo) ProtoMessage()

func (*Userinfo) ProtoReflect

func (x *Userinfo) ProtoReflect() protoreflect.Message

func (*Userinfo) Reset

func (x *Userinfo) Reset()

func (*Userinfo) String

func (x *Userinfo) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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