Documentation
¶
Index ¶
- Constants
- func GetCommand(packet []byte) (string, error)
- func GetCommandIgnoreError(packet []byte) string
- type IDPayload
- type Packet
- func From(packet []byte) (*Packet, error)
- func FromIgnoreError(packet []byte) *Packet
- func FromNew(pk *Packet, err error) *Packet
- func New(command string, payload any, key *rsa.PrivateKey) (*Packet, error)
- func NewID(id uint32, key *rsa.PrivateKey) (*Packet, error)
- func NewPing() *Packet
- func NewPong() *Packet
- func (p *Packet) GetCommand() string
- func (p *Packet) GetPayload(v any) error
- func (p *Packet) Sign(key *rsa.PrivateKey) error
- func (p *Packet) ToBytes() ([]byte, error)
- func (p *Packet) ToBytesIgnoreError() []byte
- func (p *Packet) Valid(key *rsa.PublicKey) bool
- func (p *Packet) Verify(key *rsa.PublicKey) error
Constants ¶
View Source
const ( Ping = "i" Pong = "o" ID = "id" )
Variables ¶
This section is empty.
Functions ¶
func GetCommand ¶
func GetCommandIgnoreError ¶
Types ¶
type Packet ¶
type Packet struct { Command string `json:"c,omitempty"` Payload json.RawMessage `json:"p,omitempty"` Signature []byte `json:"s,omitempty"` }
func FromIgnoreError ¶
func (*Packet) GetCommand ¶
func (*Packet) GetPayload ¶
GetPayload parameter v must be a pointer to the payload object type
func (*Packet) ToBytesIgnoreError ¶
Click to show internal directories.
Click to hide internal directories.