Documentation ¶
Overview ¶
Package gntp implements the Growl Notification Transport Protocol version 1.0.
See http://www.growlforwindows.com/gfw/help/gntp.aspx for details.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrProtocol = errors.New("notify: protocol error") ErrHash = errors.New("notify: unknown hash algorithm") ErrEncryption = errors.New("notify: unknown encryption algorithm") ErrKeyLength = errors.New("notify: key length is too short") ErrPassword = errors.New("notify: incorrect password") ErrPKCS7 = errors.New("notify: invalid PKCS #7 padding") )
Functions ¶
func NewNotifier ¶
func NewNotifier(c *Client) notify.Notifier
NewNotifier returns a new Notifier.
Register supports following icon types:
- string
- []byte
- image.Image
- io.Reader
Register accepts following keys and values types:
- gntp:display-name string
- gntp:enabled bool
- gntp:sticky bool
- gntp:priority int
Types ¶
type Callback ¶
type Callback struct { Name string ID string Result Result Timestamp time.Time Context string ContextType string Header textproto.MIMEHeader }
Callback represents a GNTP callback
type Client ¶
type Client struct { Server string Name string Icon Icon Password string HashAlgorithm HashAlgorithm EncryptionAlgorithm EncryptionAlgorithm // Custom Headers and App-Specific Headers Header map[string]interface{} Callback chan *Callback // contains filtered or unexported fields }
Client is a GNTP client.
func (*Client) Notify ¶
func (c *Client) Notify(n *Notification) (*Response, error)
Notify sends a NOTIFY request to the server.
A NOTIFY request does not use the DisplayName and Enabled fields of the Notification.
type EncryptionAlgorithm ¶
type EncryptionAlgorithm int
EncryptionAlgorithm represents an encryption algorithm of the GNTP protocol.
const ( NONE EncryptionAlgorithm = iota DES TDES // 3DES AES )
List of encryption algorithms for the GNTP protocol.
func (EncryptionAlgorithm) New ¶
func (ea EncryptionAlgorithm) New(key []byte) (cipher.Block, error)
New returns a new cipher.Block.
func (EncryptionAlgorithm) String ¶
func (ea EncryptionAlgorithm) String() string
type Error ¶
type Error struct { Code ErrorCode Description string Header textproto.MIMEHeader }
Error represents a GNTP error.
type ErrorCode ¶
type ErrorCode int
ErrorCode represents an Error-Code value.
const ( TimedOut ErrorCode = 200 NetworkFailure ErrorCode = 201 InvalidRequest ErrorCode = 300 UnknownProtocol ErrorCode = 301 UnknownProtocolVersion ErrorCode = 302 RequiredHeaderMissing ErrorCode = 303 NotAuthorized ErrorCode = 400 UnknownApplication ErrorCode = 401 UnknownNotification ErrorCode = 402 AlreadyProcessed ErrorCode = 403 NotificationDisabled ErrorCode = 404 InternalServerError ErrorCode = 500 )
List of Error-Code values.
func (ErrorCode) Description ¶
Description returns an Error-Description of the Error-Code. It returns the empty string if the code is unknown.
type HashAlgorithm ¶
type HashAlgorithm int
HashAlgorithm represents a hash algorithm of the GNTP protocol.
const ( MD5 HashAlgorithm = iota SHA1 SHA256 SHA512 )
List of hash algorithms for the GNTP protocol.
func (HashAlgorithm) New ¶
func (ha HashAlgorithm) New() (h hash.Hash, err error)
New returns a new hash.Hash.
func (HashAlgorithm) String ¶
func (i HashAlgorithm) String() string
type Icon ¶
type Icon interface{}
Icon represents an icon and which supports following types:
- string
- []byte
- image.Image
- io.Reader
type Info ¶
type Info struct { Version string MessageType string EncryptionAlgorithm EncryptionAlgorithm IV []byte HashAlgorithm HashAlgorithm KeyHash []byte Salt []byte // contains filtered or unexported fields }
Info represents a GNTP information line.
func (*Info) SetPassword ¶
SetPassword updates the IV, KeyHash, and Salt based on the specified password. Their resulting values are dependent on the values of EncryptionAlgorithm and HashAlgorithm fields.
type Notification ¶
type Notification struct { Name string DisplayName string Enabled bool ID string Title string Text string Sticky bool Priority int Icon Icon CoalescingID string CallbackContext string CallbackContextType string CallbackTarget string }
Notification represents a notification.