Documentation ¶
Index ¶
- Variables
- func CheckVoIPTopicByCert(topic string, cert *tls.Certificate) error
- func ExistOID(cert *tls.Certificate, oid asn1.ObjectIdentifier) (bool, error)
- func GetOIDValue(cert *tls.Certificate, oid asn1.ObjectIdentifier) ([][]byte, error)
- func GetTopics(src []byte) ([]string, error)
- type Client
- type Request
- type RequestHeader
- type Response
- type ResponseBody
Constants ¶
This section is empty.
Variables ¶
var ( OidPushDevelop = asn1.ObjectIdentifier([]int{1, 2, 840, 113635, 100, 6, 3, 1}) OidPushProduction = asn1.ObjectIdentifier([]int{1, 2, 840, 113635, 100, 6, 3, 2}) OidVoIPTopics = asn1.ObjectIdentifier([]int{1, 2, 840, 113635, 100, 6, 3, 6}) OidVoIP = asn1.ObjectIdentifier([]int{1, 2, 840, 113635, 100, 6, 3, 5}) )
oid info: https://images.apple.com/certificateauthority/pdf/Apple_WWDR_CPS_v1.20.pdf https://github.com/SilentCircle/apns_tools/blob/master/FakeAppleWWDRCA.cfg
Functions ¶
func CheckVoIPTopicByCert ¶
func CheckVoIPTopicByCert(topic string, cert *tls.Certificate) error
func ExistOID ¶
func ExistOID(cert *tls.Certificate, oid asn1.ObjectIdentifier) (bool, error)
func GetOIDValue ¶
func GetOIDValue(cert *tls.Certificate, oid asn1.ObjectIdentifier) ([][]byte, error)
func GetTopics ¶
GetTopics returns topics from certificate extension value Binary data format: <block start=0x30> <block size=0xD> <value start=0xc> <value size=0x2> <value byte 1> <value byte 2> <block start=0x30> <block size=0x3> <value start=0xc> <value size=0x1> <value byte 1> <value start=0xc> <value size=0x2> <value byte 1> <value byte 2>
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewFromPem ¶
func (*Client) Certificate ¶
func (c *Client) Certificate() tls.Certificate
func (*Client) SupportsVoIP ¶
type Request ¶
type Request struct { Token string `json:"token,omitempty"` Headers RequestHeader `json:"headers,omitempty"` // Payload format: // https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/PayloadKeyReference.html#//apple_ref/doc/uid/TP40008194-CH17-SW1 Payload json.RawMessage `json:"payload,omitempty"` }
func (Request) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Request) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Request) ShouldIgnore ¶ added in v1.0.2
func (*Request) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Request) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type RequestHeader ¶
type RequestHeader struct { ID string `json:"id,omitempty"` Expiration time.Time `json:"expiration,omitempty"` Priority int `json:"priority,omitempty"` Topic string `json:"topic,omitempty"` CollapseID string `json:"collapse-id,omitempty"` }
RequestHeader format: Table 8-2 APNs request headers - https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
func (RequestHeader) MarshalEasyJSON ¶
func (v RequestHeader) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (RequestHeader) MarshalJSON ¶
func (v RequestHeader) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*RequestHeader) UnmarshalEasyJSON ¶
func (v *RequestHeader) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*RequestHeader) UnmarshalJSON ¶
func (v *RequestHeader) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface
type Response ¶
type Response struct { ID string `json:"id"` StatusCode int `json:"status_code"` Body ResponseBody `json:"body"` }
Response format Table 8-3 APNs response headers, Table 8-5 APNs JSON data keys - https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
func NewResponse ¶
func (Response) MarshalEasyJSON ¶
MarshalEasyJSON supports easyjson.Marshaler interface
func (Response) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface
func (*Response) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*Response) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
type ResponseBody ¶
Table 8-5APNs JSON data keys https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
func (*ResponseBody) GetTimestamp ¶
func (r *ResponseBody) GetTimestamp() time.Time
func (ResponseBody) MarshalEasyJSON ¶
func (v ResponseBody) MarshalEasyJSON(w *jwriter.Writer)
MarshalEasyJSON supports easyjson.Marshaler interface
func (ResponseBody) MarshalJSON ¶
func (v ResponseBody) MarshalJSON() ([]byte, error)
MarshalJSON supports json.Marshaler interface
func (*ResponseBody) UnmarshalEasyJSON ¶
func (v *ResponseBody) UnmarshalEasyJSON(l *jlexer.Lexer)
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*ResponseBody) UnmarshalJSON ¶
func (v *ResponseBody) UnmarshalJSON(data []byte) error
UnmarshalJSON supports json.Unmarshaler interface