You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
Dan Ballard f04239c885
make echobot use new SetupOnion
6 years ago
Godeps Adding bulb to godep 6 years ago
application make echobot use new SetupOnion 6 years ago
channels First Cut of Applications + Bugs, Formatting 6 years ago
connection First Cut of Applications + Bugs, Formatting 6 years ago
examples/echobot First Cut of Applications + Bugs, Formatting 6 years ago
policies Brand new API v0.2 6 years ago
testing Brand new API v0.2 6 years ago
utils Add more crypto/utils and extend SetupOnion to support unix sockets 6 years ago
vendor Adding bulb to godep 6 years ago
wire Brand new API v0.2 6 years ago
.gitignore Add script for coveralls 7 years ago
.travis.yml Brand new API v0.2 6 years ago
CONTRIBUTING.md Refactor GoRicochet 7 years ago
LICENSE Brand new API v0.2 6 years ago
README.md Brand new API v0.2 6 years ago
private_key Refactor GoRicochet 7 years ago
ricochet.go First Cut of Applications + Bugs, Formatting 6 years ago
ricochet_test.go First Cut of Applications + Bugs, Formatting 6 years ago

README.md

GoRicochet Build Status Go Report Card Coverage Status

GoRicochet is an experimental implementation of the Ricochet Protocol in Go.

Features

  • A simple API that you can use to build Automated Ricochet Applications
  • A suite of regression tests that test protocol compliance.

Building an Automated Ricochet Application

Below is a simple echo bot, which responds to any chat message. You can also find this code under examples/echobot

            package main

            import (
                    "github.com/s-rah/go-ricochet"
                    "log"
            )

            type EchoBotService struct {
                    goricochet.StandardRicochetService
            }

            // Always Accept Contact Requests
            func (ts *EchoBotService) IsKnownContact(hostname string) bool {
                    return true
            }

            func (ts *EchoBotService) OnContactRequest(oc *goricochet.OpenConnection, channelID int32, nick string, message string) {
                    ts.StandardRicochetService.OnContactRequest(oc, channelID, nick, message)
                    oc.AckContactRequestOnResponse(channelID, "Accepted")
                    oc.CloseChannel(channelID)
            }

            func (ebs *EchoBotService) OnChatMessage(oc *goricochet.OpenConnection, channelID int32, messageId int32, message string) {
                    log.Printf("Received Message from %s: %s", oc.OtherHostname, message)
                    oc.AckChatMessage(channelID, messageId)
                    if oc.GetChannelType(6) == "none" {
                            oc.OpenChatChannel(6)
                    }
                    oc.SendMessage(6, message)
            }

            func main() {
                    ricochetService := new(EchoBotService)
                    ricochetService.Init("./private_key")
                    ricochetService.Listen(ricochetService, 12345)
            }

Each automated ricochet service can extend of the StandardRicochetService. From there certain functions can be extended to fully build out a complete application.

Currently GoRicochet does not establish a hidden service, so to make this service available to the world you will have to set up a hidden service

Security and Usage Note

This project is experimental and has not been independently reviewed. If you are looking for a quick and easy way to use ricochet please check out Ricochet Protocol.