Documentation
¶
Index ¶
- Constants
- Variables
- func ApnsPushHttp2(token string, service *push.Service, headers *push.Headers, ...) error
- func ConfigHandler(w http.ResponseWriter, r *http.Request)
- func InitHttpClient() error
- func InitLog() *logrus.Logger
- func InitStat()
- func LogAcceptedRequest(uri, method, proto string, length int64)
- func LogPush(id uint64, status, token string, ptime float64, req RequestGaurunNotification, ...)
- func NewApnsClientHttp2(certPath, keyPath string) (*http.Client, error)
- func NewApnsHeadersHttp2(req *RequestGaurunNotification) *push.Headers
- func NewApnsPayloadHttp2(req *RequestGaurunNotification) map[string]interface{}
- func NewApnsServiceHttp2(client *http.Client) *push.Service
- func NewTransportHttp2(cert tls.Certificate) (*http.Transport, error)
- func PrintVersion()
- func PushNotificationHandler(w http.ResponseWriter, r *http.Request)
- func RegisterHTTPHandlers()
- func RunHTTPServer()
- func SetLogLevel(log *logrus.Logger, levelString string) error
- func SetLogOut(log *logrus.Logger, outString string) error
- func StartPushWorkers(workerNum, queueNum int)
- func StatsHandler(w http.ResponseWriter, r *http.Request)
- type CertificatePem
- type ConfToml
- type ExtendJSON
- type GaurunFormatter
- type LogPushEntry
- type LogReq
- type RequestGaurun
- type RequestGaurunNotification
- type ResponseGaurun
- type SectionAndroid
- type SectionApi
- type SectionCore
- type SectionIos
- type SectionLog
- type StatAndroid
- type StatApp
- type StatIos
Constants ¶
View Source
const ( PlatFormIos = iota + 1 PlatFormAndroid )
View Source
const ( StatusAcceptedPush = "accepted-push" StatusSucceededPush = "succeeded-push" StatusFailedPush = "failed-push" )
View Source
const (
Version = "0.6.0"
)
Variables ¶
View Source
var ( ConfGaurun ConfToml QueueNotification chan RequestGaurunNotification CertificatePemIos CertificatePem LogAccess *logrus.Logger LogError *logrus.Logger StatGaurun StatApp // for numbering push OnceNumbering sync.Once WgNumbering *sync.WaitGroup SeqID uint64 GCMClient *gcm.Sender APNSClient *http.Client )
View Source
var (
PusherCount int64
)
Functions ¶
func ApnsPushHttp2 ¶ added in v0.5.0
func ConfigHandler ¶ added in v0.5.1
func ConfigHandler(w http.ResponseWriter, r *http.Request)
func InitHttpClient ¶ added in v0.5.0
func InitHttpClient() error
func LogAcceptedRequest ¶
func LogPush ¶
func LogPush(id uint64, status, token string, ptime float64, req RequestGaurunNotification, errPush error)
func NewApnsClientHttp2 ¶ added in v0.5.0
func NewApnsHeadersHttp2 ¶ added in v0.5.0
func NewApnsHeadersHttp2(req *RequestGaurunNotification) *push.Headers
func NewApnsPayloadHttp2 ¶ added in v0.5.0
func NewApnsPayloadHttp2(req *RequestGaurunNotification) map[string]interface{}
func NewApnsServiceHttp2 ¶ added in v0.5.0
func NewTransportHttp2 ¶ added in v0.5.1
func NewTransportHttp2(cert tls.Certificate) (*http.Transport, error)
func PrintVersion ¶ added in v0.5.1
func PrintVersion()
func PushNotificationHandler ¶
func PushNotificationHandler(w http.ResponseWriter, r *http.Request)
func RegisterHTTPHandlers ¶ added in v0.4.3
func RegisterHTTPHandlers()
func RunHTTPServer ¶ added in v0.4.3
func RunHTTPServer()
func StartPushWorkers ¶
func StartPushWorkers(workerNum, queueNum int)
func StatsHandler ¶ added in v0.5.1
func StatsHandler(w http.ResponseWriter, r *http.Request)
Types ¶
type CertificatePem ¶
type ConfToml ¶
type ConfToml struct { Core SectionCore `toml:"core"` Api SectionApi `toml:"api"` Android SectionAndroid `toml:"android"` Ios SectionIos `toml:"ios"` Log SectionLog `toml:"log"` }
func BuildDefaultConf ¶ added in v0.5.1
func BuildDefaultConf() ConfToml
type ExtendJSON ¶ added in v0.3.0
type GaurunFormatter ¶
type GaurunFormatter struct { }
type LogPushEntry ¶
type LogPushEntry struct { Type string `json:"type"` Time string `json:"time"` ID uint64 `json:"id"` Platform string `json:"platform"` Token string `json:"token"` Message string `json:"message"` Ptime float64 `json:"ptime"` Error string `json:"error"` // Android CollapseKey string `json:"collapse_key,omitempty"` DelayWhileIdle bool `json:"delay_while_idle,omitempty"` TimeToLive int `json:"time_to_live,omitempty"` // iOS Badge int `json:"badge,omitempty"` Sound string `json:"sound,omitempty"` ContentAvailable bool `json:"content_available,omitempty"` Expiry int `json:"expiry,omitempty"` }
type RequestGaurun ¶
type RequestGaurun struct {
Notifications []RequestGaurunNotification `json:"notifications"`
}
type RequestGaurunNotification ¶
type RequestGaurunNotification struct { // Common Tokens []string `json:"token"` Platform int `json:"platform"` Message string `json:"message"` // Android CollapseKey string `json:"collapse_key,omitempty"` DelayWhileIdle bool `json:"delay_while_idle,omitempty"` TimeToLive int `json:"time_to_live,omitempty"` // iOS Badge int `json:"badge,omitempty"` Sound string `json:"sound,omitempty"` ContentAvailable bool `json:"content_available,omitempty"` Expiry int `json:"expiry,omitempty"` Retry int `json:"retry,omitempty"` Extend []ExtendJSON `json:"extend,omitempty"` // meta ID uint64 `json:"seq_id,omitempty"` }
type ResponseGaurun ¶
type ResponseGaurun struct {
Message string `json:"message"`
}
type SectionAndroid ¶
type SectionApi ¶
type SectionCore ¶
type SectionIos ¶
type SectionIos struct { Enabled bool `toml:"enabled"` PemCertPath string `toml:"pem_cert_path"` PemKeyPath string `toml:"pem_key_path"` Sandbox bool `toml:"sandbox"` RetryMax int `toml:"retry_max"` Timeout int `toml:"timeout"` KeepAliveTimeout int `toml:"keepalive_timeout"` KeepAliveConns int `toml:"keepalive_conns"` Topic string `toml:"topic"` }
type SectionLog ¶
type StatAndroid ¶
Click to show internal directories.
Click to hide internal directories.