envelope

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DefaultTimeSource

type DefaultTimeSource struct{}

func (DefaultTimeSource) GetCurrentTimestamp

func (DefaultTimeSource) GetCurrentTimestamp() time.Time

type Envelope

type Envelope struct {
	ToUserName string
	AgentID    string
	Msg        []byte
	ReceiveID  []byte
}

type Processor

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

func NewProcessor

func NewProcessor(
	token string,
	encodingAESKey string,
	opts ...ProcessorOption,
) (*Processor, error)

func (*Processor) HandleIncomingMsg

func (p *Processor) HandleIncomingMsg(
	url *url.URL,
	body []byte,
) (Envelope, error)

func (*Processor) MakeOutgoingEnvelope

func (p *Processor) MakeOutgoingEnvelope(msg []byte) ([]byte, error)

type ProcessorOption

type ProcessorOption interface {
	// contains filtered or unexported methods
}

func WithEntropySource

func WithEntropySource(e io.Reader) ProcessorOption

func WithTimeSource

func WithTimeSource(t TimeSource) ProcessorOption

type TimeSource

type TimeSource interface {
	GetCurrentTimestamp() time.Time
}

Jump to

Keyboard shortcuts

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