Documentation ¶
Index ¶
- Variables
- func Encode(e *Endpoint) map[string]string
- func Validate(e *Endpoint) error
- func WithEndpoint(e *Endpoint) server.HandlerOption
- type API
- type Endpoint
- func (in *Endpoint) DeepCopyInto(out *Endpoint)
- func (*Endpoint) Descriptor() ([]byte, []int)
- func (m *Endpoint) Marshal() (dAtA []byte, err error)
- func (m *Endpoint) MarshalTo(dAtA []byte) (int, error)
- func (m *Endpoint) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Endpoint) ProtoMessage()
- func (m *Endpoint) Reset()
- func (m *Endpoint) String() string
- func (m *Endpoint) Unmarshal(dAtA []byte) error
- func (m *Endpoint) XSize() (n int)
- func (m *Endpoint) XXX_DiscardUnknown()
- func (m *Endpoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Endpoint) XXX_Merge(src proto.Message)
- func (m *Endpoint) XXX_Size() int
- func (m *Endpoint) XXX_Unmarshal(b []byte) error
- type Event
- func (in *Event) DeepCopyInto(out *Event)
- func (*Event) Descriptor() ([]byte, []int)
- func (m *Event) Marshal() (dAtA []byte, err error)
- func (m *Event) MarshalTo(dAtA []byte) (int, error)
- func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Event) ProtoMessage()
- func (m *Event) Reset()
- func (m *Event) String() string
- func (m *Event) Unmarshal(dAtA []byte) error
- func (m *Event) XSize() (n int)
- func (m *Event) XXX_DiscardUnknown()
- func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Event) XXX_Merge(src proto.Message)
- func (m *Event) XXX_Size() int
- func (m *Event) XXX_Unmarshal(b []byte) error
- type FileDesc
- func (in *FileDesc) DeepCopyInto(out *FileDesc)
- func (*FileDesc) Descriptor() ([]byte, []int)
- func (m *FileDesc) Marshal() (dAtA []byte, err error)
- func (m *FileDesc) MarshalTo(dAtA []byte) (int, error)
- func (m *FileDesc) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FileDesc) ProtoMessage()
- func (m *FileDesc) Reset()
- func (m *FileDesc) String() string
- func (m *FileDesc) Unmarshal(dAtA []byte) error
- func (m *FileDesc) XSize() (n int)
- func (m *FileDesc) XXX_DiscardUnknown()
- func (m *FileDesc) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileDesc) XXX_Merge(src proto.Message)
- func (m *FileDesc) XXX_Size() int
- func (m *FileDesc) XXX_Unmarshal(b []byte) error
- type FileHeader
- func (in *FileHeader) DeepCopyInto(out *FileHeader)
- func (*FileHeader) Descriptor() ([]byte, []int)
- func (m *FileHeader) Marshal() (dAtA []byte, err error)
- func (m *FileHeader) MarshalTo(dAtA []byte) (int, error)
- func (m *FileHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*FileHeader) ProtoMessage()
- func (m *FileHeader) Reset()
- func (m *FileHeader) String() string
- func (m *FileHeader) Unmarshal(dAtA []byte) error
- func (m *FileHeader) XSize() (n int)
- func (m *FileHeader) XXX_DiscardUnknown()
- func (m *FileHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FileHeader) XXX_Merge(src proto.Message)
- func (m *FileHeader) XXX_Size() int
- func (m *FileHeader) XXX_Unmarshal(b []byte) error
- type Option
- type Options
- type Pair
- func (in *Pair) DeepCopyInto(out *Pair)
- func (*Pair) Descriptor() ([]byte, []int)
- func (m *Pair) Marshal() (dAtA []byte, err error)
- func (m *Pair) MarshalTo(dAtA []byte) (int, error)
- func (m *Pair) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Pair) ProtoMessage()
- func (m *Pair) Reset()
- func (m *Pair) String() string
- func (m *Pair) Unmarshal(dAtA []byte) error
- func (m *Pair) XSize() (n int)
- func (m *Pair) XXX_DiscardUnknown()
- func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Pair) XXX_Merge(src proto.Message)
- func (m *Pair) XXX_Size() int
- func (m *Pair) XXX_Unmarshal(b []byte) error
- type Request
- func (in *Request) DeepCopyInto(out *Request)
- func (*Request) Descriptor() ([]byte, []int)
- func (m *Request) Marshal() (dAtA []byte, err error)
- func (m *Request) MarshalTo(dAtA []byte) (int, error)
- func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Request) ProtoMessage()
- func (m *Request) Reset()
- func (m *Request) String() string
- func (m *Request) Unmarshal(dAtA []byte) error
- func (m *Request) XSize() (n int)
- func (m *Request) XXX_DiscardUnknown()
- func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Request) XXX_Merge(src proto.Message)
- func (m *Request) XXX_Size() int
- func (m *Request) XXX_Unmarshal(b []byte) error
- type Response
- func (in *Response) DeepCopyInto(out *Response)
- func (*Response) Descriptor() ([]byte, []int)
- func (m *Response) Marshal() (dAtA []byte, err error)
- func (m *Response) MarshalTo(dAtA []byte) (int, error)
- func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Response) ProtoMessage()
- func (m *Response) Reset()
- func (m *Response) String() string
- func (m *Response) Unmarshal(dAtA []byte) error
- func (m *Response) XSize() (n int)
- func (m *Response) XXX_DiscardUnknown()
- func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Response) XXX_Merge(src proto.Message)
- func (m *Response) XXX_Size() int
- func (m *Response) XXX_Unmarshal(b []byte) error
- type Service
- func (in *Service) DeepCopyInto(out *Service)
- func (*Service) Descriptor() ([]byte, []int)
- func (m *Service) Marshal() (dAtA []byte, err error)
- func (m *Service) MarshalTo(dAtA []byte) (int, error)
- func (m *Service) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Service) ProtoMessage()
- func (m *Service) Reset()
- func (m *Service) String() string
- func (m *Service) Unmarshal(dAtA []byte) error
- func (m *Service) XSize() (n int)
- func (m *Service) XXX_DiscardUnknown()
- func (m *Service) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Service) XXX_Merge(src proto.Message)
- func (m *Service) XXX_Size() int
- func (m *Service) XXX_Unmarshal(b []byte) error
- type StreamType
Constants ¶
This section is empty.
Variables ¶
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 `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // Description e.g what's this endpoint for Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` // API Handler e.g rpc, proxy Handler string `protobuf:"bytes,3,opt,name=handler,proto3" json:"handler,omitempty"` // HTTP Host e.g example.com Host []string `protobuf:"bytes,4,rep,name=host,proto3" json:"host,omitempty"` // HTTP Methods e.g GET, POST Method []string `protobuf:"bytes,5,rep,name=method,proto3" json:"method,omitempty"` // HTTP Path e.g /greeter. Expect POSIX regex Path []string `protobuf:"bytes,6,rep,name=path,proto3" json:"path,omitempty"` // Entity HTTP method for resource Entity string `protobuf:"bytes,7,opt,name=entity,proto3" json:"entity,omitempty"` // Security HTTP authorization, e.g. Basic, Bearer Security string `protobuf:"bytes,8,opt,name=security,proto3" json:"security,omitempty"` // Body destination // "*" or "" - top level message value // "string" - inner message value Body string `protobuf:"bytes,9,opt,name=body,proto3" json:"body,omitempty"` // Stream flag Stream string `protobuf:"bytes,10,opt,name=stream,proto3" json:"stream,omitempty"` }
Endpoint is a mapping between an RPC method and HTTP endpoint
func (*Endpoint) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Endpoint) Descriptor ¶ added in v1.5.6
func (*Endpoint) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Endpoint) ProtoMessage ¶ added in v1.5.6
func (*Endpoint) ProtoMessage()
func (*Endpoint) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Endpoint) XXX_DiscardUnknown()
func (*Endpoint) XXX_Marshal ¶ added in v1.5.6
func (*Endpoint) XXX_Unmarshal ¶ added in v1.5.6
type Event ¶ added in v0.23.0
type Event struct { // e.g login Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // uuid Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // unix timestamp of event Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // event headers Header map[string]*Pair `` /* 153-byte string literal not displayed */ // the event data Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` }
Event A HTTP event as RPC Forwarded by the event handler
func (*Event) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Event) Descriptor ¶ added in v1.5.6
func (*Event) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Event) ProtoMessage ¶ added in v1.5.3
func (*Event) ProtoMessage()
func (*Event) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Event) XXX_DiscardUnknown()
func (*Event) XXX_Marshal ¶ added in v1.5.6
func (*Event) XXX_Unmarshal ¶ added in v1.5.6
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) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*FileDesc) Descriptor ¶ added in v1.5.6
func (*FileDesc) MarshalToSizedBuffer ¶ added in v1.5.6
func (*FileDesc) ProtoMessage ¶ added in v1.4.0
func (*FileDesc) ProtoMessage()
func (*FileDesc) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *FileDesc) XXX_DiscardUnknown()
func (*FileDesc) XXX_Marshal ¶ added in v1.5.6
func (*FileDesc) XXX_Unmarshal ¶ added in v1.5.6
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) DeepCopyInto ¶ added in v1.5.6
func (in *FileHeader) DeepCopyInto(out *FileHeader)
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*FileHeader) Descriptor ¶ added in v1.5.6
func (*FileHeader) Descriptor() ([]byte, []int)
func (*FileHeader) Marshal ¶ added in v1.5.6
func (m *FileHeader) Marshal() (dAtA []byte, err error)
func (*FileHeader) MarshalTo ¶ added in v1.5.6
func (m *FileHeader) MarshalTo(dAtA []byte) (int, error)
func (*FileHeader) MarshalToSizedBuffer ¶ added in v1.5.6
func (m *FileHeader) MarshalToSizedBuffer(dAtA []byte) (int, error)
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
func (*FileHeader) Unmarshal ¶ added in v1.5.6
func (m *FileHeader) Unmarshal(dAtA []byte) error
func (*FileHeader) XSize ¶ added in v1.5.6
func (m *FileHeader) XSize() (n int)
func (*FileHeader) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *FileHeader) XXX_DiscardUnknown()
func (*FileHeader) XXX_Marshal ¶ added in v1.5.6
func (m *FileHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FileHeader) XXX_Merge ¶ added in v1.5.6
func (m *FileHeader) XXX_Merge(src proto.Message)
func (*FileHeader) XXX_Size ¶ added in v1.5.6
func (m *FileHeader) XXX_Size() int
func (*FileHeader) XXX_Unmarshal ¶ added in v1.5.6
func (m *FileHeader) XXX_Unmarshal(b []byte) error
type Pair ¶ added in v0.23.0
type Pair struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` }
func (*Pair) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Pair) Descriptor ¶ added in v1.5.6
func (*Pair) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Pair) ProtoMessage ¶ added in v1.5.6
func (*Pair) ProtoMessage()
func (*Pair) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Pair) XXX_DiscardUnknown()
func (*Pair) XXX_Marshal ¶ added in v1.5.6
func (*Pair) XXX_Unmarshal ¶ added in v1.5.6
type Request ¶ added in v0.23.0
type Request struct { Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"` Header map[string]*Pair `` /* 153-byte string literal not displayed */ Get map[string]*Pair `` /* 147-byte string literal not displayed */ Post map[string]*Pair `` /* 149-byte string literal not displayed */ Body string `protobuf:"bytes,6,opt,name=body,proto3" json:"body,omitempty"` Url string `protobuf:"bytes,7,opt,name=url,proto3" json:"url,omitempty"` }
Request A HTTP request as RPC Forward by the api handler +gogo:genproto=true
func (*Request) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Request) Descriptor ¶ added in v1.5.6
func (*Request) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Request) ProtoMessage ¶ added in v1.5.6
func (*Request) ProtoMessage()
func (*Request) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Request) XXX_DiscardUnknown()
func (*Request) XXX_Marshal ¶ added in v1.5.6
func (*Request) XXX_Unmarshal ¶ added in v1.5.6
type Response ¶ added in v0.23.0
type Response struct { StatusCode int32 `protobuf:"varint,1,opt,name=statusCode,proto3" json:"statusCode,omitempty"` Header map[string]*Pair `` /* 153-byte string literal not displayed */ Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` }
Response A HTTP response as RPC Expected response for the api handler
func (*Response) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Response) Descriptor ¶ added in v1.5.6
func (*Response) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Response) ProtoMessage ¶ added in v1.5.6
func (*Response) ProtoMessage()
func (*Response) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Response) XXX_DiscardUnknown()
func (*Response) XXX_Marshal ¶ added in v1.5.6
func (*Response) XXX_Unmarshal ¶ added in v1.5.6
type Service ¶ added in v0.23.0
type Service struct { // Name of service Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // The endpoint for this service Endpoint *Endpoint `protobuf:"bytes,2,opt,name=endpoint,proto3" json:"endpoint,omitempty"` // Versions of this service Services []*registry.Service `protobuf:"bytes,3,rep,name=services,proto3" json:"services,omitempty"` }
Service represents an API service
func (*Service) DeepCopyInto ¶ added in v1.5.6
DeepCopyInto is an auto-generated deepcopy function, coping the receiver, writing into out. in must be no-nil.
func (*Service) Descriptor ¶ added in v1.5.6
func (*Service) MarshalToSizedBuffer ¶ added in v1.5.6
func (*Service) ProtoMessage ¶ added in v1.5.6
func (*Service) ProtoMessage()
func (*Service) XXX_DiscardUnknown ¶ added in v1.5.6
func (m *Service) XXX_DiscardUnknown()
func (*Service) XXX_Marshal ¶ added in v1.5.6
func (*Service) XXX_Unmarshal ¶ added in v1.5.6
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 |