Documentation ¶
Index ¶
- Constants
- Variables
- func ConfigGaurunHandler(w http.ResponseWriter, r *http.Request)
- func InitGCMClient()
- func InitLog() *logrus.Logger
- func InitStatGaurun()
- func LogAcceptedRequest(uri, method, proto string, length int64)
- func LogPush(id uint64, status, token string, ptime float64, req RequestGaurunNotification, ...)
- func PrintGaurunVersion()
- func PushNotificationHandler(w http.ResponseWriter, r *http.Request)
- func SetLogLevel(log *logrus.Logger, levelString string) error
- func SetLogOut(log *logrus.Logger, outString string) error
- func StartPushWorkers(workerNum, queueNum int)
- func StatsGaurunHandler(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 ( ErrorStatusUnknown = iota ErrorStatusNotRegistered ErrorStatusMismatchSenderId ErrorStatusCanonicalId )
View Source
const ( StatusAcceptedPush = "accepted-push" StatusSucceededPush = "succeeded-push" StatusFailedPush = "failed-push" )
View Source
const EpApnsProd = "gateway.push.apple.com:2195"
View Source
const EpApnsSandbox = "gateway.sandbox.push.apple.com:2195"
View Source
const Version = "0.4.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 TransportGaurun *http.Transport )
Functions ¶
func ConfigGaurunHandler ¶
func ConfigGaurunHandler(w http.ResponseWriter, r *http.Request)
func InitGCMClient ¶ added in v0.2.1
func InitGCMClient()
func InitStatGaurun ¶
func InitStatGaurun()
func LogAcceptedRequest ¶
func LogPush ¶
func LogPush(id uint64, status, token string, ptime float64, req RequestGaurunNotification, errPush error)
func PrintGaurunVersion ¶
func PrintGaurunVersion()
func PushNotificationHandler ¶
func PushNotificationHandler(w http.ResponseWriter, r *http.Request)
func StartPushWorkers ¶
func StartPushWorkers(workerNum, queueNum int)
func StatsGaurunHandler ¶
func StatsGaurunHandler(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 BuildDefaultConfGaurun ¶
func BuildDefaultConfGaurun() 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"` 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"` Expiry int `json:"expiry,omitempty"` Retry int `json:"retry,omitempty"` Extend []ExtendJSON `json:"extend,omitempty"` // meta IDs []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"` TimeoutError int `toml:"timeout_error"` KeepAliveMax int `toml:"keepalive_max"` KeepAliveIdleTimeout int `toml:"keepalive_idle_timeout"` }
type SectionLog ¶
type StatAndroid ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.