godog

module
v0.0.0-...-61777e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2018 License: MIT

README

Godog

godog

This is a general-purpose API for writing programs that interact with Cryptodog.

The multiparty implementation has been mostly a line-by-line translation from Cryptodog's, with some help from the protocol spec. However, I cannot guarantee that it is a safe one.

API usage

Connection (Cryptodog XMPP+WebSocket Protocol)

import "github.com/superp00t/godog/phoxy"

opts := phoxy.Opts {
    Type:     phoxy.WS,
    Username: "username",
    Chatroom: "lobby",
    Endpoint: "wss://crypto.dog/websocket",
}

conn, err := phoxy.New(&opts)
if err != nil {
    // handle err
}
Event handlers
conn.HandleFunc(phoxy.USERJOIN, func(ev *phoxy.Event) {
    conn.Groupf("Greetings, %s!", ev.Username)
})

conn.HandleFunc(phoxy.USERQUIT, func(ev *phoxy.Event) {
    conn.Groupf("Auf Wiedersehen, %s!", ev.Username)
})

// Echo in all caps
conn.HandleFunc(phoxy.GROUPMESSAGE, func(ev *phoxy.Event) {
    conn.GroupMessage(strings.ToUpper(ev.Body))
})

err := conn.Connect()
if err != nil {
    // handle err
}

Directories

Path Synopsis
cmd
Package multiparty implements the Cryptodog Multiparty Protocol as used in Cryptodog version 2.5.0, and previously, Cryptocat 2.
Package multiparty implements the Cryptodog Multiparty Protocol as used in Cryptodog version 2.5.0, and previously, Cryptocat 2.
ws

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL