core

package
v0.0.0-...-db0aad3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthServerAddr  = "localhost:8080"
	PushServerAddr  = "localhost:8082"
	UserServerAddr  = "localhost:8084"
	StatsServerAddr = "localhost:8086"
)
View Source
const (
	TestAuthToken    = ""
	TestAuthExpireAt = 0
)
View Source
const (
	TestTasks  = ""
	TestGroup  = ""
	TestToken  = ""
	TestAlias  = ""
	TestTaskId = ""
	TestTag    = ""
)
View Source
const (
	GTBaseUrl = "https://restapi.getui.com/v2/%s"
)

Variables

This section is empty.

Functions

func DELETE

func DELETE(ctx context.Context, url, token string, body interface{}, timeout time.Duration) ([]byte, error)

func GET

func GET(ctx context.Context, url, token string, body interface{}, timeout time.Duration) ([]byte, error)

func POST

func POST(ctx context.Context, url, token string, body interface{}, timeout time.Duration) ([]byte, error)

func PUT

func PUT(ctx context.Context, url, token string, body interface{}, timeout time.Duration) ([]byte, error)

Types

type AuthCache

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

func NewAuthCache

func NewAuthCache() (*AuthCache, error)

func (*AuthCache) Close

func (c *AuthCache) Close()

func (*AuthCache) GetAuth

func (c *AuthCache) GetAuth(uniqueId UniqueId) (*AuthToken, error)

type AuthDao

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

func NewAuthDao

func NewAuthDao(conf *PushConfig) (*AuthDao, error)

func (*AuthDao) Close

func (d *AuthDao) Close()

func (*AuthDao) GetAuth

func (d *AuthDao) GetAuth(id UniqueId) (*AuthToken, error)

func (*AuthDao) SetAuth

func (d *AuthDao) SetAuth(id UniqueId, auth *AuthToken) error

type AuthToken

type AuthToken struct {
	Token    string `json:"token" bson:"token"`
	ExpireAt int64  `json:"expire_at" bson:"expire_at"`
}

type PushConfig

type PushConfig struct {
	Mongo struct {
		Name            string `json:"name"`
		Url             string `json:"url"`
		DataBase        string `json:"database"`
		AuthCollection  string `json:"auth_collection"`
		StatsCollection string `json:"stats_collection"`
		PoolSize        int    `json:"pool_size"`
	} `json:"mongo"`
	GeTui struct {
		AgentId      string `json:"agent_id"`
		BundleId     string `json:"bundle_id"`
		AppId        string `json:"app_id"`
		AppKey       string `json:"app_key"`
		MasterSecret string `json:"master_secret"`
	} `json:"getui"`
	Apns struct {
		AgentId  string `json:"agent_id"`
		BundleId string `json:"bundle_id"`
		Env      string `json:"env"`
		Key      string `json:"key"`
		KeyId    string `json:"key_id"`
		TeamId   string `json:"team_id"`
	} `json:"apns"`
}

type RestyClient

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

func NewRestyClient

func NewRestyClient(client *http.Client) (*RestyClient, error)

func (*RestyClient) DELETE

func (r *RestyClient) DELETE(ctx context.Context, url, token string, body interface{}) ([]byte, error)

func (*RestyClient) GET

func (r *RestyClient) GET(ctx context.Context, url, token string, body interface{}) ([]byte, error)

func (*RestyClient) POST

func (r *RestyClient) POST(ctx context.Context, url, token string, body interface{}) ([]byte, error)

func (*RestyClient) PUT

func (r *RestyClient) PUT(ctx context.Context, url, token string, body interface{}) ([]byte, error)

type StatsDao

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

func NewStatsDao

func NewStatsDao(conf *PushConfig) (*StatsDao, error)

func (*StatsDao) Close

func (d *StatsDao) Close()

func (*StatsDao) SetStats

func (d *StatsDao) SetStats(id UniqueId, describe string, time time.Time, content interface{}) error

type UniqueId

type UniqueId struct {
	PushAgent string `json:"push_agent"`
	BundleId  string `json:"bundle_id"`
}

Jump to

Keyboard shortcuts

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