import "go.chromium.org/goma/server/httprpc"
Package httprpc provides goma httprpc implementation.
admission.go auth.go client.go doc.go server.go trace.go
AdmissionControl adds admission controller to h.
AuthHandler converts given http.Handler to access controlled HTTP handler using AuthChecker. Alternatives: WithAuth handler option if it requires retry with Unauthenticated error.
func Call(ctx context.Context, client *http.Client, url string, req proto.Message, resp proto.Message) error
Call calls remote services over http.
func Handler(name string, req, resp proto.Message, h func(context.Context, proto.Message) (proto.Message, error), opts ...HandlerOption) http.Handler
Handler returns http.Handler to serve http rpc handler.
RemoteAddr returns http's remote (client) addr. https://cloud.google.com/compute/docs/load-balancing/http/#components
func StreamHandler(name string, h func(ctx context.Context, w http.ResponseWriter, req *http.Request) error, opts ...HandlerOption) http.Handler
Handler returns http.Handler to serve http stream.
Trace adds labels to trace span for requested path. It would be used as top handler for incoming request under ochttp.Handler.
AdmissionController checks incoming request.
Auth authenticates the request.
type AuthChecker interface { // Check represents the function to check HTTP access. // If the access is granted, it returns non-nil enduser.EndUser instance. Check(context.Context, *http.Request) (*enduser.EndUser, error) }
AuthChecker represents an interface to checks HTTP access.
type Client struct { *http.Client // endpoint URL. URL string // ContentEncoding of the request. "identity", "gzip" or "deflate". // "deflate" uses "deflate" compressed data (RFC1951) without // zlib header, different from RFC7230 says, for histrical reason. // default is "deflate" for backward compatibility. // TODO: change default to gzip? ContentEncoding string }
Client is httprpc client.
Call calls remote services over http.
type HandlerOption func(*option)
HandlerOption sets option for handler.
func Timeout(d time.Duration) HandlerOption
Timeout sets timeout to the handler. Default is 1 second.
func WithAPIKey(apiKey string) HandlerOption
WithAPIKey sets api key in outgoing context.
func WithAuth(a Auth) HandlerOption
WithAuth sets auth to the handler.
func WithCluster(c string) HandlerOption
WithCluster sets cluster name to the handler for logging/monitoring etc.
func WithNamespace(ns string) HandlerOption
WithNamespace sets cluster namespace to the handler for logging/monitoring etc.
func WithRetry(retry rpc.Retry) HandlerOption
WithRetry sets retry config to the handler.
Path | Synopsis |
---|---|
authdb | Package authdb implements authdb service for goma httprpc. |
bytestream | Package bytestream implements bytestream for goma http. |
exec | Package exec implements exec service for goma httprpc. |
execlog | Package execlog implements log service for goma httprpc. |
file | Package file implements file service for goma httprpc. |
settings | Package settings implements settings service for goma httprpc. |
Package httprpc imports 19 packages (graph) and is imported by 12 packages. Updated 2020-10-27. Refresh now. Tools for package owners.