client

package
v0.0.0-...-4c85678 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: LGPL-3.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Open = iota
	Closing
	Closed
	Reconnecting

	DefaultPort = 8337
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PrivateKeyPKCS1 []byte
	Certificate     []byte
	Host            string
	Port            int
	Version         uint64

	State int
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*Client, error)

func NewClientFromKey

func NewClientFromKey(config *Config) (*Client, error)

func (*Client) AddIOSPushToken

func (c *Client) AddIOSPushToken(ctx context.Context, token string) error

func (*Client) Close

func (c *Client) Close()

func (*Client) CloseWithoutReconnect

func (c *Client) CloseWithoutReconnect()

func (*Client) Connect

func (c *Client) Connect(ctx context.Context) error

func (*Client) DeauthAll

func (c *Client) DeauthAll(ctx context.Context) error

func (*Client) DeleteIOSPushToken

func (c *Client) DeleteIOSPushToken(ctx context.Context, token string) error

func (*Client) ExtendSendToken

func (c *Client) ExtendSendToken(ctx context.Context, token []byte, addedSeconds int) (time.Time, error)

func (*Client) ListIOSPushTokens

func (c *Client) ListIOSPushTokens(ctx context.Context) ([]*PushToken, error)

func (*Client) ListTokens

func (c *Client) ListTokens(ctx context.Context) ([]*Token, error)

func (*Client) MakeSendToken

func (c *Client) MakeSendToken(ctx context.Context, startTime time.Time, endTime time.Time) ([]byte, error)

func (*Client) Notifications

func (c *Client) Notifications() chan interface{}

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

func (*Client) RegisterIncoming

func (c *Client) RegisterIncoming(ctx context.Context, tokenHex string) (*RegisterIncomingResponse, error)

func (*Client) RevokeSendToken

func (c *Client) RevokeSendToken(ctx context.Context, token []byte) error

func (*Client) Send

func (c *Client) Send(ctx context.Context, sendToken, body []byte) error

func (*Client) Trim

func (c *Client) Trim(ctx context.Context, token []byte, seq uint64) (uint64, error)

func (*Client) Want

func (c *Client) Want(ctx context.Context, token []byte, seq uint64) (*Message, error)

type Config

type Config struct {
	Host            string
	Port            int
	Reconnect       bool
	Ping            bool
	NewState        StateRecv
	Debug           bool
	PrivateKeyPKCS1 []byte
	Cert            []byte
}

type DoneIntro

type DoneIntro struct{}

type Message

type Message struct {
	Body []byte
	Seq  uint64
}

type Notification

type Notification struct {
	Seq   uint64
	Token []byte
}

type PushToken

type PushToken struct {
	Value     string
	StartTime time.Time
}

type RegisterIncomingResponse

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

type StateRecv

type StateRecv func(int)

type Token

type Token struct {
	Value     []byte
	Seq       uint64
	StartTime time.Time
	EndTime   time.Time
}

Jump to

Keyboard shortcuts

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