Documentation
¶
Overview ¶
Package krpcgo provides the client to communicate with a kRPC server.
Index ¶
- type KRPCClient
- func (c *KRPCClient) Call(call *types.ProcedureCall) (*types.ProcedureResult, error)
- func (c *KRPCClient) CallMultiple(calls []*types.ProcedureCall) ([]*types.ProcedureResult, error)
- func (c *KRPCClient) Close() error
- func (c *KRPCClient) Connect(ctx context.Context) error
- func (c *KRPCClient) Receive() ([]byte, error)
- func (c *KRPCClient) Send(data []byte) error
- type KRPCClientConfig
- type Stream
- type StreamClient
- func (s *StreamClient) Close() error
- func (s *StreamClient) DeleteStream(id uint64)
- func (s *StreamClient) GetStream(id uint64) *Stream[[]byte]
- func (s *StreamClient) Receive() ([]byte, error)
- func (s *StreamClient) Run(ctx context.Context)
- func (s *StreamClient) Send(data []byte) error
- func (s *StreamClient) WriteToStream(id uint64, b []byte)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KRPCClient ¶
type KRPCClient struct { KRPCClientConfig *StreamClient // contains filtered or unexported fields }
KRPCClient is a client for a kRPC server.
func DefaultKRPCClient ¶
func DefaultKRPCClient() *KRPCClient
DefaultKRPCClient creates a new kRPC client with all default parameters. Equivalent to `NewKRPCClient(KRPCClientConfig{})`.
func NewKRPCClient ¶
func NewKRPCClient(cfg KRPCClientConfig) *KRPCClient
NewKRPCClient creates a new client.
func (*KRPCClient) Call ¶
func (c *KRPCClient) Call(call *types.ProcedureCall) (*types.ProcedureResult, error)
Call performs a remote procedure call.
func (*KRPCClient) CallMultiple ¶
func (c *KRPCClient) CallMultiple(calls []*types.ProcedureCall) ([]*types.ProcedureResult, error)
CallMultiple performs a batch of procedure calls to the rpc server.
func (*KRPCClient) Connect ¶
func (c *KRPCClient) Connect(ctx context.Context) error
Connect connects to a kRPC server.
func (*KRPCClient) Receive ¶
func (c *KRPCClient) Receive() ([]byte, error)
Receive receives protobuf-encoded data from a kRPC server.
func (*KRPCClient) Send ¶
func (c *KRPCClient) Send(data []byte) error
Send sends protobuf-encoded data to a kRPC server.
type KRPCClientConfig ¶
type KRPCClientConfig struct { // Host is the kRPC server host. Defaults to "localhost". Host string // RPCPort is the kRPC server port. Defaults to "50000". RPCPort string // StreamPort is the stream server port. Defaults to "50001". StreamPort string // ClientName is the client name sent to the kRPC server. Defaults to "krpc-go". ClientName string // RPCOnly will only set up the RPC client (and not the stream client) when enabled. // Disabled by default. RPCOnly bool }
KRPCClientConfig is the config for a kRPC client.
func (*KRPCClientConfig) SetDefaults ¶
func (cfg *KRPCClientConfig) SetDefaults()
SetDefaults sets the config defaults.
type Stream ¶
Stream is a struct for receiving stream data.
type StreamClient ¶
StreamClient is a client for kRPC streams.
func NewStreamClient ¶
func NewStreamClient(conn net.Conn) *StreamClient
NewStreamClient creates a new stream client with an existing connection.
func (*StreamClient) DeleteStream ¶
func (s *StreamClient) DeleteStream(id uint64)
DeleteStream removes a byte stream for a particular stream ID. Note that if the stream hasn't yet been closed on the kRPC server, a new local stream will eventually be recreated.
func (*StreamClient) GetStream ¶
func (s *StreamClient) GetStream(id uint64) *Stream[[]byte]
GetStream gets a byte stream for a particular stream ID.
func (*StreamClient) Receive ¶
func (s *StreamClient) Receive() ([]byte, error)
Receive receives protobuf-encoded data from a stream server.
func (*StreamClient) Run ¶
func (s *StreamClient) Run(ctx context.Context)
Run starts the stream handler.
func (*StreamClient) Send ¶
func (s *StreamClient) Send(data []byte) error
Send sends protobuf-encoded data to a stream server.
func (*StreamClient) WriteToStream ¶
func (s *StreamClient) WriteToStream(id uint64, b []byte)
WriteToStream writes data to a particular stream.
Directories
¶
Path | Synopsis |
---|---|
Package dockingcamera provides methods to invoke procedures in the DockingCamera service.
|
Package dockingcamera provides methods to invoke procedures in the DockingCamera service. |
Package drawing provides methods to invoke procedures in the Drawing service.
|
Package drawing provides methods to invoke procedures in the Drawing service. |
Package infernalrobotics provides methods to invoke procedures in the InfernalRobotics service.
|
Package infernalrobotics provides methods to invoke procedures in the InfernalRobotics service. |
Package kerbalalarmclock provides methods to invoke procedures in the KerbalAlarmClock service.
|
Package kerbalalarmclock provides methods to invoke procedures in the KerbalAlarmClock service. |
Package krpc provides methods to invoke procedures in the KRPC service.
|
Package krpc provides methods to invoke procedures in the KRPC service. |
lib
|
|
encode
Package encode provides methods to convert values to and from kRPC's protobuf format.
|
Package encode provides methods to convert values to and from kRPC's protobuf format. |
gen
Package gen provides methods to generate kRPC services.
|
Package gen provides methods to generate kRPC services. |
service
Package service provides some definitions needed to generate services.
|
Package service provides some definitions needed to generate services. |
utils
Package utils provides utilities for krpc-go.
|
Package utils provides utilities for krpc-go. |
Package lidar provides methods to invoke procedures in the LiDAR service.
|
Package lidar provides methods to invoke procedures in the LiDAR service. |
Package remotetech provides methods to invoke procedures in the RemoteTech service.
|
Package remotetech provides methods to invoke procedures in the RemoteTech service. |
Package spacecenter provides methods to invoke procedures in the SpaceCenter service.
|
Package spacecenter provides methods to invoke procedures in the SpaceCenter service. |
Package types provides various types for krpc-go.
|
Package types provides various types for krpc-go. |
Package ui provides methods to invoke procedures in the UI service.
|
Package ui provides methods to invoke procedures in the UI service. |