Documentation
¶
Index ¶
- Constants
- Variables
- func FindConfigFile(fileName string) string
- func GetIpAddress(r *http.Request) string
- func LoadConfig(fileName string)
- func Log(level string, msg string)
- func LogCritical(msg string)
- func LogInfo(msg string)
- func NewPrometheusHandler() http.Handler
- func Start()
- func Stop()
- type AndroidNotificationServer
- type AndroidPushSettings
- type AppleNotificationServer
- type ApplePushSettings
- type ConfigPushProxy
- type NotificationServer
- type PushNotification
- type PushNotificationAck
- type PushResponse
Constants ¶
View Source
const ( PUSH_NOTIFY_APPLE = "apple" PUSH_NOTIFY_ANDROID = "android" PUSH_TYPE_MESSAGE = "message" PUSH_TYPE_CLEAR = "clear" )
View Source
const ( PUSH_STATUS = "status" PUSH_STATUS_OK = "OK" PUSH_STATUS_FAIL = "FAIL" PUSH_STATUS_REMOVE = "REMOVE" PUSH_STATUS_ERROR_MSG = "error" )
View Source
const ( HEADER_FORWARDED = "X-Forwarded-For" HEADER_REAL_IP = "X-Real-IP" WAIT_FOR_SERVER_SHUTDOWN = time.Second * 5 CONNECTION_TIMEOUT_SECONDS = 60 )
Variables ¶
View Source
var MetricsEnabled bool
Functions ¶
func FindConfigFile ¶
func GetIpAddress ¶
func LoadConfig ¶
func LoadConfig(fileName string)
func LogCritical ¶
func LogCritical(msg string)
func NewPrometheusHandler ¶
Types ¶
type AndroidNotificationServer ¶
type AndroidNotificationServer struct {
AndroidPushSettings AndroidPushSettings
}
func (*AndroidNotificationServer) Initialize ¶
func (me *AndroidNotificationServer) Initialize() bool
func (*AndroidNotificationServer) SendNotification ¶
func (me *AndroidNotificationServer) SendNotification(msg *PushNotification) PushResponse
type AndroidPushSettings ¶
type AppleNotificationServer ¶
type AppleNotificationServer struct {
ApplePushSettings ApplePushSettings
AppleClient *apns.Client
}
func (*AppleNotificationServer) Initialize ¶
func (me *AppleNotificationServer) Initialize() bool
func (*AppleNotificationServer) SendNotification ¶
func (me *AppleNotificationServer) SendNotification(msg *PushNotification) PushResponse
type ApplePushSettings ¶
type ConfigPushProxy ¶
type ConfigPushProxy struct {
ListenAddress string
ThrottlePerSec int
ThrottleMemoryStoreSize int
ThrottleVaryByHeader string
EnableMetrics bool
ApplePushSettings []ApplePushSettings
AndroidPushSettings []AndroidPushSettings
}
var CfgPP *ConfigPushProxy = &ConfigPushProxy{}
type NotificationServer ¶
type NotificationServer interface {
SendNotification(msg *PushNotification) PushResponse
Initialize() bool
}
func NewAndroideNotificationServer ¶
func NewAndroideNotificationServer(settings AndroidPushSettings) NotificationServer
func NewAppleNotificationServer ¶
func NewAppleNotificationServer(settings ApplePushSettings) NotificationServer
type PushNotification ¶
type PushNotification struct {
Id string `json:"id"`
AckId string `json:"ack_id"`
Platform string `json:"platform"`
ServerId string `json:"server_id"`
DeviceId string `json:"device_id"`
Category string `json:"category"`
Sound string `json:"sound"`
Message string `json:"message"`
Badge int `json:"badge"`
ContentAvailable int `json:"cont_ava"`
TeamId string `json:"team_id"`
ChannelId string `json:"channel_id"`
PostId string `json:"post_id"`
RootId string `json:"root_id"`
ChannelName string `json:"channel_name"`
Type string `json:"type"`
SenderName string `json:"sender_name"`
SenderId string `json:"sender_id"`
OverrideUsername string `json:"override_username"`
OverrideIconUrl string `json:"override_icon_url"`
FromWebhook string `json:"from_webhook"`
Version string `json:"version"`
}
func PushNotificationFromJson ¶
func PushNotificationFromJson(data io.Reader) *PushNotification
func (*PushNotification) ToJson ¶
func (me *PushNotification) ToJson() string
type PushNotificationAck ¶
type PushNotificationAck struct {
Id string `json:"id"`
Platform string `json:"platform"`
Type string `json:"type"`
}
func PushNotificationAckFromJson ¶
func PushNotificationAckFromJson(data io.Reader) *PushNotificationAck
func (*PushNotificationAck) ToJson ¶
func (me *PushNotificationAck) ToJson() string
type PushResponse ¶
func LogError ¶
func LogError(msg string) PushResponse
func NewErrorPushResponse ¶
func NewErrorPushResponse(message string) PushResponse
func NewOkPushResponse ¶
func NewOkPushResponse() PushResponse
func NewRemovePushResponse ¶
func NewRemovePushResponse() PushResponse
func PushResponseFromJson ¶
func PushResponseFromJson(data io.Reader) PushResponse
func (*PushResponse) ToJson ¶
func (me *PushResponse) ToJson() string
Click to show internal directories.
Click to hide internal directories.