Documentation
¶
Overview ¶
Package server is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.10.1.
It is generated from these files:
service.proto
Index ¶
- Constants
- Variables
- func GenerateDeviceID() string
- func GenerateID() string
- func NewZeroConfChannel() chan bool
- func RegisterService(name string, port int, protocol string, ch chan bool, uuid ...string)
- func WriteError(resp http.ResponseWriter, err error)
- type Adapter
- func (*Adapter) Descriptor() ([]byte, []int)
- func (m *Adapter) GetAddress() string
- func (m *Adapter) GetAlias() string
- func (m *Adapter) GetDiscoverable() bool
- func (m *Adapter) GetDiscovering() bool
- func (m *Adapter) GetName() string
- func (m *Adapter) GetPairable() bool
- func (m *Adapter) GetPath() string
- func (m *Adapter) GetPowered() bool
- func (m *Adapter) Marshal() (dAtA []byte, err error)
- func (m *Adapter) MarshalTo(dAtA []byte) (int, error)
- func (m *Adapter) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Adapter) ProtoMessage()
- func (m *Adapter) Reset()
- func (m *Adapter) Size() (n int)
- func (m *Adapter) String() string
- func (m *Adapter) Unmarshal(dAtA []byte) error
- func (m *Adapter) XXX_DiscardUnknown()
- func (m *Adapter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Adapter) XXX_Merge(src proto.Message)
- func (m *Adapter) XXX_Size() int
- func (m *Adapter) XXX_Unmarshal(b []byte) error
- type Adapters
- func (*Adapters) Descriptor() ([]byte, []int)
- func (m *Adapters) GetAdapters() []*Adapter
- func (m *Adapters) Marshal() (dAtA []byte, err error)
- func (m *Adapters) MarshalTo(dAtA []byte) (int, error)
- func (m *Adapters) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Adapters) ProtoMessage()
- func (m *Adapters) Reset()
- func (m *Adapters) Size() (n int)
- func (m *Adapters) String() string
- func (m *Adapters) Unmarshal(dAtA []byte) error
- func (m *Adapters) XXX_DiscardUnknown()
- func (m *Adapters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Adapters) XXX_Merge(src proto.Message)
- func (m *Adapters) XXX_Size() int
- func (m *Adapters) XXX_Unmarshal(b []byte) error
- type Bluetooth
- type Card
- func (*Card) Descriptor() ([]byte, []int)
- func (m *Card) GetAddress() string
- func (m *Card) GetNum() int32
- func (m *Card) Marshal() (dAtA []byte, err error)
- func (m *Card) MarshalTo(dAtA []byte) (int, error)
- func (m *Card) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Card) ProtoMessage()
- func (m *Card) Reset()
- func (m *Card) Size() (n int)
- func (m *Card) String() string
- func (m *Card) Unmarshal(dAtA []byte) error
- func (m *Card) XXX_DiscardUnknown()
- func (m *Card) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Card) XXX_Merge(src proto.Message)
- func (m *Card) XXX_Size() int
- func (m *Card) XXX_Unmarshal(b []byte) error
- type Device
- func (*Device) Descriptor() ([]byte, []int)
- func (m *Device) GetAdapter() string
- func (m *Device) GetAddress() string
- func (m *Device) GetAlias() string
- func (m *Device) GetBlocked() bool
- func (m *Device) GetConnected() bool
- func (m *Device) GetName() string
- func (m *Device) GetPaired() bool
- func (m *Device) GetPath() string
- func (m *Device) GetTrusted() bool
- func (m *Device) Marshal() (dAtA []byte, err error)
- func (m *Device) MarshalTo(dAtA []byte) (int, error)
- func (m *Device) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Device) ProtoMessage()
- func (m *Device) Reset()
- func (m *Device) Size() (n int)
- func (m *Device) String() string
- func (m *Device) Unmarshal(dAtA []byte) error
- func (m *Device) XXX_DiscardUnknown()
- func (m *Device) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Device) XXX_Merge(src proto.Message)
- func (m *Device) XXX_Size() int
- func (m *Device) XXX_Unmarshal(b []byte) error
- type Devices
- func (*Devices) Descriptor() ([]byte, []int)
- func (m *Devices) GetDevices() []*Device
- func (m *Devices) Marshal() (dAtA []byte, err error)
- func (m *Devices) MarshalTo(dAtA []byte) (int, error)
- func (m *Devices) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Devices) ProtoMessage()
- func (m *Devices) Reset()
- func (m *Devices) Size() (n int)
- func (m *Devices) String() string
- func (m *Devices) Unmarshal(dAtA []byte) error
- func (m *Devices) XXX_DiscardUnknown()
- func (m *Devices) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Devices) XXX_Merge(src proto.Message)
- func (m *Devices) XXX_Size() int
- func (m *Devices) XXX_Unmarshal(b []byte) error
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (m *Empty) Marshal() (dAtA []byte, err error)
- func (m *Empty) MarshalTo(dAtA []byte) (int, error)
- func (m *Empty) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) Size() (n int)
- func (m *Empty) String() string
- func (m *Empty) Unmarshal(dAtA []byte) error
- func (m *Empty) XXX_DiscardUnknown()
- func (m *Empty) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Empty) XXX_Merge(src proto.Message)
- func (m *Empty) XXX_Size() int
- func (m *Empty) XXX_Unmarshal(b []byte) error
- type HTTPClient
- type Params
- func (*Params) Descriptor() ([]byte, []int)
- func (m *Params) GetName() string
- func (m *Params) Marshal() (dAtA []byte, err error)
- func (m *Params) MarshalTo(dAtA []byte) (int, error)
- func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Params) ProtoMessage()
- func (m *Params) Reset()
- func (m *Params) Size() (n int)
- func (m *Params) String() string
- func (m *Params) Unmarshal(dAtA []byte) error
- func (m *Params) XXX_DiscardUnknown()
- func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Params) XXX_Merge(src proto.Message)
- func (m *Params) XXX_Size() int
- func (m *Params) XXX_Unmarshal(b []byte) error
- type Server
- func (s *Server) Connect(ctx context.Context, req *Params) (res *Adapters, err error)
- func (s *Server) Disconnect(ctx context.Context, req *Params) (res *Adapters, err error)
- func (s *Server) EnableCard(ctx context.Context, req *Card) (res *Status, err error)
- func (s *Server) ListAdapters(ctx context.Context, req *Empty) (res *Adapters, err error)
- func (s *Server) ListDevices(ctx context.Context, req *Empty) (res *Devices, err error)
- func (s *Server) Pair(ctx context.Context, req *Params) (res *Adapters, err error)
- func (s Server) StartDiscovery(ctx context.Context, req *Adapter) (res *Status, err error)
- func (s Server) StopDiscovery(ctx context.Context, req *Adapter) (res *Status, err error)
- type Status
- func (*Status) Descriptor() ([]byte, []int)
- func (m *Status) GetOk() bool
- func (m *Status) Marshal() (dAtA []byte, err error)
- func (m *Status) MarshalTo(dAtA []byte) (int, error)
- func (m *Status) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Status) ProtoMessage()
- func (m *Status) Reset()
- func (m *Status) Size() (n int)
- func (m *Status) String() string
- func (m *Status) Unmarshal(dAtA []byte) error
- func (m *Status) XXX_DiscardUnknown()
- func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Status) XXX_Merge(src proto.Message)
- func (m *Status) XXX_Size() int
- func (m *Status) XXX_Unmarshal(b []byte) error
- type TwirpServer
Constants ¶
const BluetoothPathPrefix = "/twirp/karaks.service.bluetooth.Bluetooth/"
BluetoothPathPrefix is used for all URL paths on a twirp Bluetooth server. Requests are always: POST BluetoothPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
Functions ¶
func GenerateDeviceID ¶
func GenerateDeviceID() string
func GenerateID ¶
func GenerateID() string
func NewZeroConfChannel ¶
func NewZeroConfChannel() chan bool
func RegisterService ¶
TODO: Re-register service
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format (code, msg, meta). Useful outside of the Twirp server (e.g. http middleware), but does not trigger hooks. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type Adapter ¶
type Adapter struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Alias string `protobuf:"bytes,3,opt,name=alias,proto3" json:"alias,omitempty"` Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"` Discoverable bool `protobuf:"varint,5,opt,name=discoverable,proto3" json:"discoverable,omitempty"` Pairable bool `protobuf:"varint,6,opt,name=pairable,proto3" json:"pairable,omitempty"` Powered bool `protobuf:"varint,7,opt,name=powered,proto3" json:"powered,omitempty"` Discovering bool `protobuf:"varint,8,opt,name=discovering,proto3" json:"discovering,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Adapter) Descriptor ¶
func (*Adapter) GetAddress ¶
func (*Adapter) GetDiscoverable ¶
func (*Adapter) GetDiscovering ¶
func (*Adapter) GetPairable ¶
func (*Adapter) GetPowered ¶
func (*Adapter) MarshalToSizedBuffer ¶
func (*Adapter) ProtoMessage ¶
func (*Adapter) ProtoMessage()
func (*Adapter) XXX_DiscardUnknown ¶
func (m *Adapter) XXX_DiscardUnknown()
func (*Adapter) XXX_Marshal ¶
func (*Adapter) XXX_Unmarshal ¶
type Adapters ¶
type Adapters struct { Adapters []*Adapter `protobuf:"bytes,1,rep,name=adapters,proto3" json:"adapters,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Adapters) Descriptor ¶
func (*Adapters) GetAdapters ¶
func (*Adapters) MarshalToSizedBuffer ¶
func (*Adapters) ProtoMessage ¶
func (*Adapters) ProtoMessage()
func (*Adapters) XXX_DiscardUnknown ¶
func (m *Adapters) XXX_DiscardUnknown()
func (*Adapters) XXX_Marshal ¶
func (*Adapters) XXX_Unmarshal ¶
type Bluetooth ¶
type Bluetooth interface { ListDevices(context.Context, *Empty) (*Devices, error) ListAdapters(context.Context, *Empty) (*Adapters, error) Connect(context.Context, *Params) (*Adapters, error) Disconnect(context.Context, *Params) (*Adapters, error) Pair(context.Context, *Params) (*Adapters, error) EnableCard(context.Context, *Card) (*Status, error) StartDiscovery(context.Context, *Adapter) (*Status, error) StopDiscovery(context.Context, *Adapter) (*Status, error) }
func NewBluetoothJSONClient ¶
func NewBluetoothJSONClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Bluetooth
NewBluetoothJSONClient creates a JSON client that implements the Bluetooth interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewBluetoothProtobufClient ¶
func NewBluetoothProtobufClient(addr string, client HTTPClient, opts ...twirp.ClientOption) Bluetooth
NewBluetoothProtobufClient creates a Protobuf client that implements the Bluetooth interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type Card ¶
type Card struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Num int32 `protobuf:"varint,2,opt,name=num,proto3" json:"num,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Card) Descriptor ¶
func (*Card) GetAddress ¶
func (*Card) ProtoMessage ¶
func (*Card) ProtoMessage()
func (*Card) XXX_DiscardUnknown ¶
func (m *Card) XXX_DiscardUnknown()
func (*Card) XXX_Unmarshal ¶
type Device ¶
type Device struct { Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Alias string `protobuf:"bytes,3,opt,name=alias,proto3" json:"alias,omitempty"` Address string `protobuf:"bytes,4,opt,name=address,proto3" json:"address,omitempty"` Adapter string `protobuf:"bytes,5,opt,name=adapter,proto3" json:"adapter,omitempty"` Paired bool `protobuf:"varint,6,opt,name=paired,proto3" json:"paired,omitempty"` Connected bool `protobuf:"varint,7,opt,name=connected,proto3" json:"connected,omitempty"` Trusted bool `protobuf:"varint,8,opt,name=trusted,proto3" json:"trusted,omitempty"` Blocked bool `protobuf:"varint,9,opt,name=blocked,proto3" json:"blocked,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Device) Descriptor ¶
func (*Device) GetAdapter ¶
func (*Device) GetAddress ¶
func (*Device) GetBlocked ¶
func (*Device) GetConnected ¶
func (*Device) GetTrusted ¶
func (*Device) MarshalToSizedBuffer ¶
func (*Device) ProtoMessage ¶
func (*Device) ProtoMessage()
func (*Device) XXX_DiscardUnknown ¶
func (m *Device) XXX_DiscardUnknown()
func (*Device) XXX_Marshal ¶
func (*Device) XXX_Unmarshal ¶
type Devices ¶
type Devices struct { Devices []*Device `protobuf:"bytes,1,rep,name=devices,proto3" json:"devices,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Devices) Descriptor ¶
func (*Devices) GetDevices ¶
func (*Devices) MarshalToSizedBuffer ¶
func (*Devices) ProtoMessage ¶
func (*Devices) ProtoMessage()
func (*Devices) XXX_DiscardUnknown ¶
func (m *Devices) XXX_DiscardUnknown()
func (*Devices) XXX_Marshal ¶
func (*Devices) XXX_Unmarshal ¶
type Empty ¶
type Empty struct { XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Empty) Descriptor ¶
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
func (*Empty) XXX_DiscardUnknown ¶
func (m *Empty) XXX_DiscardUnknown()
func (*Empty) XXX_Marshal ¶
func (*Empty) XXX_Unmarshal ¶
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type Params ¶
type Params struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Params) Descriptor ¶
func (*Params) MarshalToSizedBuffer ¶
func (*Params) ProtoMessage ¶
func (*Params) ProtoMessage()
func (*Params) XXX_DiscardUnknown ¶
func (m *Params) XXX_DiscardUnknown()
func (*Params) XXX_Marshal ¶
func (*Params) XXX_Unmarshal ¶
type Server ¶
func (*Server) Disconnect ¶
func (*Server) EnableCard ¶
func (*Server) ListAdapters ¶
func (*Server) ListDevices ¶
func (Server) StartDiscovery ¶
type Status ¶
type Status struct { Ok bool `protobuf:"varint,1,opt,name=ok,proto3" json:"ok,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Status) Descriptor ¶
func (*Status) MarshalToSizedBuffer ¶
func (*Status) ProtoMessage ¶
func (*Status) ProtoMessage()
func (*Status) XXX_DiscardUnknown ¶
func (m *Status) XXX_DiscardUnknown()
func (*Status) XXX_Marshal ¶
func (*Status) XXX_Unmarshal ¶
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string // PathPrefix returns the HTTP URL path prefix for all methods handled by this // service. This can be used with an HTTP mux to route twirp requests // alongside non-twirp requests on one HTTP listener. PathPrefix() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewBluetoothServer ¶
func NewBluetoothServer(svc Bluetooth, hooks *twirp.ServerHooks) TwirpServer