Documentation
¶
Index ¶
- Constants
- type GRPCClient
- func (c *GRPCClient) Close() error
- func (c *GRPCClient) GetAPIHost() string
- func (c *GRPCClient) GetAPIKey() string
- func (c *GRPCClient) GetNodeConfig() (*panel.NodeInfo, error)
- func (c *GRPCClient) GetNodeID() int
- func (c *GRPCClient) GetNodeInfo() (*panel.NodeInfo, error)
- func (c *GRPCClient) GetSecret() string
- func (c *GRPCClient) GetUserAlive() (map[int]int, error)
- func (c *GRPCClient) GetUserList() ([]panel.UserInfo, error)
- func (c *GRPCClient) GetUsers() ([]panel.UserInfo, error)
- func (c *GRPCClient) HealthCheck() error
- func (c *GRPCClient) IsConnected() bool
- func (c *GRPCClient) IsSignEnabled() bool
- func (c *GRPCClient) Register(authKey, name, host string, port int32, serverVersion, serverOS string) (*panel.Credential, error)
- func (c *GRPCClient) ReportNodeLogs(entries []panel.NodeLogEntry) error
- func (c *GRPCClient) ReportNodeOnlineUsers(data *map[int][]string) error
- func (c *GRPCClient) ReportNodeRuntimeHealth(healthy bool, message string) error
- func (c *GRPCClient) ReportNodeStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
- func (c *GRPCClient) ReportOnline(onlineUsers map[int][]string) error
- func (c *GRPCClient) ReportStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
- func (c *GRPCClient) ReportTraffic(traffics []panel.UserTraffic) error
- func (c *GRPCClient) ReportUserTraffic(traffics []panel.UserTraffic) error
- func (c *GRPCClient) SendOnlineThroughStream(onlineUsers map[int][]string) error
- func (c *GRPCClient) SendStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
- func (c *GRPCClient) SendTrafficThroughStream(traffics []panel.UserTraffic) error
- func (c *GRPCClient) SetNodeType(nodeType string)
- func (c *GRPCClient) SetOnConfigUpdate(callback func(*pb.NodeConfigResponse))
- func (c *GRPCClient) SetOnUserUpdate(callback func(*pb.StatusResponse))
- func (c *GRPCClient) StartStreams() error
- func (c *GRPCClient) SupportsSync() bool
- type GRPCClientConfig
- type NodeLogServiceClient
Constants ¶
const NodeLogService_ReportLogs_FullMethodName = "/v2board.NodeLogService/ReportLogs"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is a gRPC transport implementation for panel communication.
func NewFromAPIConfig ¶
func NewFromAPIConfig(cfg *conf.ApiConfig) (*GRPCClient, error)
NewFromAPIConfig creates a GRPCClient from common node ApiConfig.
func NewGRPCClient ¶
func NewGRPCClient(cfg *GRPCClientConfig) (*GRPCClient, error)
NewGRPCClient creates a gRPC client.
func (*GRPCClient) GetAPIHost ¶
func (c *GRPCClient) GetAPIHost() string
func (*GRPCClient) GetAPIKey ¶
func (c *GRPCClient) GetAPIKey() string
func (*GRPCClient) GetNodeConfig ¶
func (c *GRPCClient) GetNodeConfig() (*panel.NodeInfo, error)
GetNodeConfig pulls node configuration from panel over gRPC.
func (*GRPCClient) GetNodeID ¶
func (c *GRPCClient) GetNodeID() int
func (*GRPCClient) GetNodeInfo ¶
func (c *GRPCClient) GetNodeInfo() (*panel.NodeInfo, error)
func (*GRPCClient) GetSecret ¶
func (c *GRPCClient) GetSecret() string
func (*GRPCClient) GetUserAlive ¶
func (c *GRPCClient) GetUserAlive() (map[int]int, error)
func (*GRPCClient) GetUserList ¶
func (c *GRPCClient) GetUserList() ([]panel.UserInfo, error)
func (*GRPCClient) GetUsers ¶
func (c *GRPCClient) GetUsers() ([]panel.UserInfo, error)
GetUsers fetches users from panel over gRPC.
func (*GRPCClient) HealthCheck ¶
func (c *GRPCClient) HealthCheck() error
func (*GRPCClient) IsConnected ¶
func (c *GRPCClient) IsConnected() bool
func (*GRPCClient) IsSignEnabled ¶
func (c *GRPCClient) IsSignEnabled() bool
func (*GRPCClient) Register ¶
func (c *GRPCClient) Register(authKey, name, host string, port int32, serverVersion, serverOS string) (*panel.Credential, error)
Register registers node by auth key and returns credentials.
func (*GRPCClient) ReportNodeLogs ¶
func (c *GRPCClient) ReportNodeLogs(entries []panel.NodeLogEntry) error
func (*GRPCClient) ReportNodeOnlineUsers ¶
func (c *GRPCClient) ReportNodeOnlineUsers(data *map[int][]string) error
func (*GRPCClient) ReportNodeRuntimeHealth ¶
func (c *GRPCClient) ReportNodeRuntimeHealth(healthy bool, message string) error
ReportNodeRuntimeHealth uses the existing node-log RPC so REST and gRPC transports expose the same runtime-health signal without a proto breaking change to the legacy heartbeat message.
func (*GRPCClient) ReportNodeStatus ¶
func (c *GRPCClient) ReportNodeStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
func (*GRPCClient) ReportOnline ¶
func (c *GRPCClient) ReportOnline(onlineUsers map[int][]string) error
ReportOnline reports online user IP data over gRPC.
func (*GRPCClient) ReportStatus ¶
func (c *GRPCClient) ReportStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
ReportStatus reports node metrics over gRPC.
func (*GRPCClient) ReportTraffic ¶
func (c *GRPCClient) ReportTraffic(traffics []panel.UserTraffic) error
ReportTraffic reports user traffic over gRPC.
func (*GRPCClient) ReportUserTraffic ¶
func (c *GRPCClient) ReportUserTraffic(traffics []panel.UserTraffic) error
func (*GRPCClient) SendOnlineThroughStream ¶
func (c *GRPCClient) SendOnlineThroughStream(onlineUsers map[int][]string) error
func (*GRPCClient) SendStatus ¶
func (c *GRPCClient) SendStatus(stats *monitor.SystemInfo, onlineUsers int, upload, download int64) error
func (*GRPCClient) SendTrafficThroughStream ¶
func (c *GRPCClient) SendTrafficThroughStream(traffics []panel.UserTraffic) error
func (*GRPCClient) SetNodeType ¶
func (c *GRPCClient) SetNodeType(nodeType string)
func (*GRPCClient) SetOnConfigUpdate ¶
func (c *GRPCClient) SetOnConfigUpdate(callback func(*pb.NodeConfigResponse))
func (*GRPCClient) SetOnUserUpdate ¶
func (c *GRPCClient) SetOnUserUpdate(callback func(*pb.StatusResponse))
func (*GRPCClient) StartStreams ¶
func (c *GRPCClient) StartStreams() error
StartStreams starts optional bidirectional streams.
func (*GRPCClient) SupportsSync ¶
func (c *GRPCClient) SupportsSync() bool
type GRPCClientConfig ¶
type GRPCClientConfig struct {
Host string
APIHost string
NodeID int
APIKey string
Secret string
KeepaliveTime time.Duration
UseTLS bool
ServerName string
EnableSign bool
SupportsSync bool
}
GRPCClientConfig defines gRPC dial and auth settings.
type NodeLogServiceClient ¶
type NodeLogServiceClient interface {
ReportLogs(ctx context.Context, in *dynamicpb.Message, opts ...grpc.CallOption) (*pb.StatusResponse, error)
}
func NewNodeLogServiceClient ¶
func NewNodeLogServiceClient(cc grpc.ClientConnInterface) NodeLogServiceClient