Documentation ¶
Overview ¶
Package nats_proxy is a generated protocol buffer package.
It is generated from these files:
message.proto
It has these top-level messages:
Cookie Message
Index ¶
- Constants
- type Cookie
- type Filter
- type Gateway
- type Handler
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetBody() []byte
- func (m *Message) GetCookies() map[string]*Cookie
- func (m *Message) GetHeader() map[string]string
- func (m *Message) GetMethod() string
- func (m *Message) GetStatus() int32
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) String() string
- type Option
- func WithCookies(cookies ...string) Option
- func WithFilters(filters ...Filter) Option
- func WithHandler(h Handler) Option
- func WithHeaders(headers ...string) Option
- func WithNats(nc *nats.Conn) Option
- func WithNopHandler() Option
- func WithNotFoundEnabled(enabled bool) Option
- func WithQueue(queue string) Option
- func WithSubject(subject string) Option
- func WithTimeout(d time.Duration) Option
- func WithUrl(url string) Option
- type Router
Constants ¶
const ( // DefaultSubject provides the name of the root subject nats-proxy will bind to DefaultSubject = "api" // DefaultTimeout specifies the maximum amount of time a request may take DefaultTimeout = time.Second * 10 // DefaultQueue specifies the name of the queue for Conn.QueueSubscribe DefaultQueue = "service" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cookie ¶
type Cookie struct { Value string `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"` Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` }
func (*Cookie) Descriptor ¶
func (*Cookie) ProtoMessage ¶
func (*Cookie) ProtoMessage()
type Filter ¶
Filter allows filters to be applied after nats-proxy has transformed the request into a *Message
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway is our http -> nats gateway
func NewGateway ¶
NewGateway returns a new http to nats gateway with the options provided
type Handler ¶
Handler publishes messages to nats and receives the response
type Message ¶
type Message struct { Status int32 `protobuf:"varint,1,opt,name=status" json:"status,omitempty"` Method string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"` Header map[string]string `` /* 132-byte string literal not displayed */ Cookies map[string]*Cookie `` /* 134-byte string literal not displayed */ Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` }
func (*Message) Descriptor ¶
func (*Message) GetCookies ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
type Option ¶
type Option func(*config)
func WithCookies ¶
WithCookies specifies the specific cookies that should be passed across nats
func WithFilters ¶
WithFilters allows gateway filters to be specified; applies ONLY to Gateway
func WithHandler ¶
WithHandler allows the underlying handler to be specified; useful primarily for testing
func WithHeaders ¶
WithHeaders specifies http headers that should be passed across nats
func WithNopHandler ¶
func WithNopHandler() Option
WithNopHandler provides an nop handler useful for testing; the content submitted will be echoed back
func WithNotFoundEnabled ¶
WithNotFoundEnabled specifies whether or not the ```*nats_proxy.Router``` should respond with 404 Not Found for routes it's unable to handle
func WithSubject ¶
WithSubject specifies the nats subject root to publish to
func WithTimeout ¶
WithTimeout specifies how long a single request can take; defaults to ```nats_proxy.DefaultTimeout```