Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithEndpoint ¶
func WithEndpoint(e *Endpoint) server.HandlerOption
WithEndpoint returns a server.HandlerOption with endpoint metadata set
Usage:
proto.RegisterHandler(service.Server(), new(Handler), api.WithEndpoint( &api.Endpoint{ Name: "Greeter.Hello", Path: []string{"/greeter"}, }, ))
Types ¶
type Endpoint ¶ added in v0.23.0
type Endpoint struct { // RPC Method e.g. Greeter.Hello Name string `json:"name,omitempty"` // Description e.g what's this endpoint for Description string `json:"description,omitempty"` // API Handler e.g rpc, proxy Handler string `json:"handler,omitempty"` // HTTP Host e.g example.com Host []string `json:"host,omitempty"` // HTTP Methods e.g GET, POST Method []string `json:"method,omitempty"` // HTTP Path e.g /greeter. Expect POSIX regex Path []string `json:"path,omitempty"` // Body destination // "*" or "" - top level message value // "string" - inner message value Body string `json:"body,omitempty"` // Stream flag Stream StreamType `json:"stream,omitempty"` }
Endpoint is a mapping between an RPC method and HTTP endpoint
type Event ¶ added in v0.23.0
type Event struct { // e.g login Name string `json:"name,omitempty"` // uuid Id string `json:"id,omitempty"` // unix timestamp of event Timestamp int64 `json:"timestamp,omitempty"` // event headers Header map[string]*Pair `json:"header,omitempty"` // the event data Data string `json:"data,omitempty"` }
Event A HTTP event as RPC Forwarded by the event handler
type FileDesc ¶ added in v1.4.0
type FileDesc struct { // 文件名称 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // 读取偏离量 Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` }
func (*FileDesc) ProtoMessage ¶ added in v1.4.0
func (*FileDesc) ProtoMessage()
type FileHeader ¶ added in v1.4.0
type FileHeader struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` Length int64 `protobuf:"varint,3,opt,name=length,proto3" json:"length,omitempty"` Chunk []byte `protobuf:"bytes,4,opt,name=chunk,proto3" json:"chunk,omitempty"` }
func (*FileHeader) ProtoMessage ¶ added in v1.4.0
func (*FileHeader) ProtoMessage()
func (*FileHeader) Reset ¶ added in v1.4.0
func (m *FileHeader) Reset()
func (*FileHeader) String ¶ added in v1.4.0
func (m *FileHeader) String() string
type Request ¶ added in v0.23.0
type Request struct { Method string `json:"method,omitempty"` Path string `json:"path,omitempty"` Header map[string]*Pair `json:"header,omitempty"` Get map[string]*Pair `json:"get,omitempty"` Post map[string]*Pair `json:"post,omitempty"` Body string `json:"body,omitempty"` Url string `json:"url,omitempty"` }
Request A HTTP request as RPC Forward by the api handler
type Response ¶ added in v0.23.0
type Response struct { StatusCode int32 `json:"statusCode,omitempty"` Header map[string]*Pair `json:"header,omitempty"` Body string `json:"body,omitempty"` }
Response A HTTP response as RPC Expected response for the api handler
type Service ¶ added in v0.23.0
type Service struct { // Name of service Name string `json:"name,omitempty"` // The endpoint for this service Endpoint *Endpoint `json:"endpoint,omitempty"` // Versions of this service Services []*registry.Service `json:"services,omitempty"` }
Service represents an API service
type StreamType ¶ added in v1.4.0
type StreamType string
const ( Server StreamType = "server" Client StreamType = "client" Bidirectional StreamType = "bidirectional" )
Directories ¶
Path | Synopsis |
---|---|
Package handler provides http handlers
|
Package handler provides http handlers |
api
Package api provides an http-rpc handler which provides the entire http request over rpc
|
Package api provides an http-rpc handler which provides the entire http request over rpc |
event
Package event provides a handler which publishes an event
|
Package event provides a handler which publishes an event |
http
Package http is a http reverse proxy handler
|
Package http is a http reverse proxy handler |
rpc
Package rpc is a vine rpc handler.
|
Package rpc is a vine rpc handler. |
web
Package web contains the web handler including websocket support
|
Package web contains the web handler including websocket support |
Package resolver resolves a http request to an endpoint
|
Package resolver resolves a http request to an endpoint |
grpc
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service
|
Package grpc resolves a grpc service like /greeter.Say/Hello to greeter service |
host
Package host resolves using http host
|
Package host resolves using http host |
path
Package path resolves using http path
|
Package path resolves using http path |
vpath
Package vpath resolves using http path and recognised versioned urls
|
Package vpath resolves using http path and recognised versioned urls |
Package router provides api service routing
|
Package router provides api service routing |
registry
Package registry provides a dynamic api service router
|
Package registry provides a dynamic api service router |
Package server provides an API gateway server which handles inbound requests
|
Package server provides an API gateway server which handles inbound requests |
http
Package http provides a http server with features; acme, cors, etc
|
Package http provides a http server with features; acme, cors, etc |
Click to show internal directories.
Click to hide internal directories.