swissknife

package
v0.0.0-...-c76ecf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultLogger

type DefaultLogger struct {
	// contains filtered or unexported fields
}

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

func (*DefaultLogger) Debug

func (dl *DefaultLogger) Debug(v ...interface{})

func (*DefaultLogger) Debugf

func (dl *DefaultLogger) Debugf(format string, v ...interface{})

func (*DefaultLogger) Error

func (dl *DefaultLogger) Error(v ...interface{})

func (*DefaultLogger) Errorf

func (dl *DefaultLogger) Errorf(format string, v ...interface{})

func (*DefaultLogger) Fatal

func (dl *DefaultLogger) Fatal(v ...interface{})

func (*DefaultLogger) Fatalf

func (dl *DefaultLogger) Fatalf(format string, v ...interface{})

func (*DefaultLogger) GetLevel

func (dl *DefaultLogger) GetLevel() LogLevel

func (*DefaultLogger) Info

func (dl *DefaultLogger) Info(v ...interface{})

func (*DefaultLogger) Infof

func (dl *DefaultLogger) Infof(format string, v ...interface{})

func (*DefaultLogger) SetLevel

func (dl *DefaultLogger) SetLevel(level LogLevel)

func (*DefaultLogger) Warn

func (dl *DefaultLogger) Warn(v ...interface{})

func (*DefaultLogger) Warnf

func (dl *DefaultLogger) Warnf(format string, v ...interface{})

type EncryptedRPCStream

type EncryptedRPCStream struct {
	EncryptedStream []byte
	Nonce           []byte
}

type ITlsRpcClient

type ITlsRpcClient interface {
	CloseClient()
	SetLogger(logger Logger)
	ConnectToRpcServerTls(serviceMethod string, args []byte) ([]byte, error)
}

func NewITlsRpcClient

func NewITlsRpcClient(caCrtPath, clientCrtPath, clientKeyPath, address, name string) (ITlsRpcClient, error)

NewITlsRpcClient creates a new TLS RPC client and connects to the specified RPC server, using the specified certificate path to load the TLS configuration. The client is named for logging purposes.

The returned error is non-nil if the client fails to connect to the server.

type ITlsRpcServer

type ITlsRpcServer interface {
	CloseServer()
	RegisterMethod(serviceName string, service any) error
	Serve()
	SetLogger(logger Logger)
}

func NewITlsRpcServer

func NewITlsRpcServer(certPath, keyPath, capath, port string) (ITlsRpcServer, error)

NewITlsRpcServer creates a new TLS RPC server that listens on the specified port and uses the specified certificate and key files to configure the TLS connection. The returned error is non-nil if the server fails to listen on the specified port.

The returned ITlsRpcServer object is ready to use for RPC registrations and serving.

type LogLevel

type LogLevel int

LogLevel represents different logging levels

const (
	LogLevelDebug LogLevel = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
	LogLevelFatal
)

func (LogLevel) String

func (l LogLevel) String() string

type Logger

type Logger interface {
	Debug(v ...interface{})
	Debugf(format string, v ...interface{})
	Info(v ...interface{})
	Infof(format string, v ...interface{})
	Warn(v ...interface{})
	Warnf(format string, v ...interface{})
	Error(v ...interface{})
	Errorf(format string, v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	SetLevel(level LogLevel)
	GetLevel() LogLevel
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL