internal

package
v0.0.0-...-1341f38 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunScript

func RunScript(ctx context.Context, name string, args ...string) error

Types

type CredentialGetter

type CredentialGetter func(host string) (string, string, error)

type Executor

type Executor func(ctx context.Context, name string, args ...string) error

type FSRepo

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

func (*FSRepo) Exists

func (fs *FSRepo) Exists(topic, name string) (bool, error)

func (*FSRepo) Get

func (fs *FSRepo) Get(topic, name string) (*os.File, error)

func (*FSRepo) Store

func (fs *FSRepo) Store(topic, fpath string) (string, error)

type FTPFetcher

type FTPFetcher struct{}

FTPFetcher is a Fetcher for downloading ftp:// URLs. There is no connection caching, so every fetch creates a new FTP connection.

func (*FTPFetcher) Fetch

func (f *FTPFetcher) Fetch(url string, dst io.Writer) error

func (*FTPFetcher) FetchContext

func (f *FTPFetcher) FetchContext(ctx context.Context, url string, dst io.Writer) error

type Fetcher

type Fetcher interface {
	// Fetch the file at url to dest. They file will exist at dest unless err is non-nil.
	Fetch(url string, dst io.Writer) error
	// FetchContext is the same as Fetch but takes a context to potentially cancel the fetch.
	FetchContext(ctx context.Context, url string, dst io.Writer) error
}

func FindFetcher

func FindFetcher(url string) Fetcher

FindFetcher returns a fetcher for the URL, if available, otherwise nil.

type FetcherFactory

type FetcherFactory func(url string) Fetcher

type HTTPFetcher

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

func (*HTTPFetcher) Fetch

func (f *HTTPFetcher) Fetch(url string, dst io.Writer) error

func (*HTTPFetcher) FetchContext

func (f *HTTPFetcher) FetchContext(ctx context.Context, url string, dst io.Writer) error

type Integrity

type Integrity struct {
	Method string `json:"method"`
	Value  string `json:"value"`
}

type Logger

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

func NewLogger

func NewLogger(debug bool) *Logger

func (*Logger) Debug

func (l *Logger) Debug(fmt string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(fmt string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(fmt string, args ...interface{})

type MQTTReceiver

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

func (*MQTTReceiver) Err

func (r *MQTTReceiver) Err() error

func (*MQTTReceiver) Message

func (r *MQTTReceiver) Message() *Message

func (*MQTTReceiver) Next

func (r *MQTTReceiver) Next() bool

type MQTTReceiverOpt

type MQTTReceiverOpt func(*MQTTReceiver)

func WithClientID

func WithClientID(id string) MQTTReceiverOpt

func WithDebug

func WithDebug(debug bool) MQTTReceiverOpt

func WithEnvCredentials

func WithEnvCredentials(pfx string) MQTTReceiverOpt

func WithIgnoreTopicErrors

func WithIgnoreTopicErrors(b bool) MQTTReceiverOpt

func WithQoS

func WithQoS(qos byte, cleanStart bool) MQTTReceiverOpt

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) MQTTReceiverOpt

type Message

type Message struct {
	Topic    string
	Received time.Time
	Source   string
	Payload  WISMessage
}

WIS is the message as defined in https://github.com/wmo-im/GTStoWIS2/tree/main/message_format

type ReceiveError

type ReceiveError struct {
	Topic string
	Body  []byte
	Err   error
}

ReceiveError is any error that occurs receiving or decoding a message

func (*ReceiveError) Error

func (e *ReceiveError) Error() string

type Receiver

type Receiver interface {
	Err() error
	Next() bool
	Message() *Message
}

func NewMQTTReceiver

func NewMQTTReceiver(ctx context.Context, brokerURL string, topics []string, opts ...MQTTReceiverOpt) (Receiver, error)

type Repo

type Repo interface {
	Store(topic, src string) (string, error)
	Get(topic, name string) (*os.File, error)
	Exists(topic, name string) (bool, error)
}

func NewRepo

func NewRepo(path string) (Repo, error)

type TopicsError

type TopicsError struct {
	Failed []string
}

func (*TopicsError) Error

func (e *TopicsError) Error() string

type WISMessage

type WISMessage struct {
	PubTime   *time.Time `json:"pubTime"`
	BaseURL   string     `json:"baseUrl"`
	RelPath   string     `json:"relPath"`
	Integrity Integrity  `json:"integrity"`
	Size      int64      `json:"size"`
	RetPath   string     `json:"retPath"`
}

func (WISMessage) IsValid

func (msg WISMessage) IsValid() error

func (WISMessage) URL

func (msg WISMessage) URL() string

Jump to

Keyboard shortcuts

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