client

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadP12 added in v0.15.0

func LoadP12(filename, password string) (*tls.Certificate, []*x509.Certificate, error)

Types

type CertificateConfig added in v0.15.0

type CertificateConfig struct {
	XMLName      xml.Name `xml:"certificateConfig"`
	ValidityDays string   `xml:"validityDays,attr"`
	NameEntries  struct {
		NameEntry []struct {
			Value string `xml:"value,attr"`
			Name  string `xml:"name,attr"`
		} `xml:"nameEntry"`
	} `xml:"nameEntries"`
}

type ClientHandler

type ClientHandler interface {
	GetName() string
	HasUID(uid string) bool
	GetUids() map[string]string
	GetUser() *model.User
	GetVersion() int32
	SendMsg(msg *cot.CotMessage) error
	GetLastSeen() *time.Time
	CanSeeScope(scope string) bool
}

type ConnClientHandler

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

func NewConnClientHandler

func NewConnClientHandler(name string, conn net.Conn, config *HandlerConfig) *ConnClientHandler

func (*ConnClientHandler) CanSeeScope

func (h *ConnClientHandler) CanSeeScope(scope string) bool

func (*ConnClientHandler) ForAllUID added in v0.14.7

func (h *ConnClientHandler) ForAllUID(fn func(string, string) bool)

func (*ConnClientHandler) GetLastSeen

func (h *ConnClientHandler) GetLastSeen() *time.Time

func (*ConnClientHandler) GetName

func (h *ConnClientHandler) GetName() string

func (*ConnClientHandler) GetUID added in v0.14.7

func (h *ConnClientHandler) GetUID(callsign string) string

func (*ConnClientHandler) GetUids

func (h *ConnClientHandler) GetUids() map[string]string

func (*ConnClientHandler) GetUser

func (h *ConnClientHandler) GetUser() *model.User

func (*ConnClientHandler) GetVersion

func (h *ConnClientHandler) GetVersion() int32

func (*ConnClientHandler) HasUID added in v0.14.7

func (h *ConnClientHandler) HasUID(uid string) bool

func (*ConnClientHandler) IsActive

func (h *ConnClientHandler) IsActive() bool

func (*ConnClientHandler) SendCot added in v0.14.0

func (h *ConnClientHandler) SendCot(msg *cotproto.TakMessage) error

func (*ConnClientHandler) SendMsg

func (h *ConnClientHandler) SendMsg(msg *cot.CotMessage) error

func (*ConnClientHandler) SetVersion

func (h *ConnClientHandler) SetVersion(n int32)

func (*ConnClientHandler) Start

func (h *ConnClientHandler) Start()

type Enroller added in v0.15.0

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

func NewEnroller added in v0.15.0

func NewEnroller(host, user, passwd string, save bool) *Enroller

func (*Enroller) GetOrEnrollCert added in v0.15.0

func (e *Enroller) GetOrEnrollCert(ctx context.Context, uid, version string) (*tls.Certificate, []*x509.Certificate, error)

type HandlerConfig

type HandlerConfig struct {
	User         *model.User
	Serial       string
	UID          string
	IsClient     bool
	MessageCb    func(msg *cot.CotMessage)
	RemoveCb     func(ch ClientHandler)
	NewContactCb func(uid, callsign string)
	RoutePings   bool
	Logger       *slog.Logger
}

type Request added in v0.15.0

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

func NewRequest added in v0.15.0

func NewRequest(c *http.Client, logger *slog.Logger) *Request

func (*Request) Args added in v0.15.0

func (r *Request) Args(args map[string]string) *Request

func (*Request) Auth added in v0.15.0

func (r *Request) Auth(login, passw string) *Request

func (*Request) Body added in v0.15.0

func (r *Request) Body(body io.Reader) *Request

func (*Request) Do added in v0.15.0

func (r *Request) Do(ctx context.Context) (io.ReadCloser, error)

func (*Request) GetJSON added in v0.15.0

func (r *Request) GetJSON(ctx context.Context, obj any) error

func (*Request) Post added in v0.15.0

func (r *Request) Post() *Request

func (*Request) Put added in v0.15.0

func (r *Request) Put() *Request

func (*Request) URL added in v0.17.0

func (r *Request) URL(url string) *Request

Jump to

Keyboard shortcuts

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