Merge branch 'v1-cleanup' of openprivacy/libricochet-go into master
This commit is contained in:
commit
1131bc930e
|
@ -49,7 +49,7 @@ func (ebi *EchoBotInstance) ChatMessage(messageID uint32, when time.Time, messag
|
|||
return true
|
||||
}
|
||||
|
||||
// ChatMessageAck is called whenever a connected peer acknolwedges a message that EchoBot sent.
|
||||
// ChatMessageAck is called whenever a connected peer acknowledges a message that EchoBot sent.
|
||||
func (ebi *EchoBotInstance) ChatMessageAck(messageID uint32, accepted bool) {
|
||||
|
||||
}
|
||||
|
@ -86,6 +86,11 @@ func main() {
|
|||
echobot := new(application.RicochetApplication)
|
||||
cpubk, cprivk, err := ed25519.GenerateKey(rand.Reader)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("Error generating keys: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// Turn on the echobot onion service in Tor.
|
||||
listenService, err := acn.Listen(cprivk, application.RicochetPort)
|
||||
if err != nil {
|
||||
|
|
|
@ -381,6 +381,12 @@ func (rc *Connection) controlPacket(handler Handler, res *Protocol_Data_Control.
|
|||
return rc.channelManager.OpenChannelRequestFromPeer(opm.GetChannelIdentifier(), chandler)
|
||||
}
|
||||
channel, err := rc.buildChannel(chandler, openChannel)
|
||||
|
||||
if err != nil {
|
||||
log.Errorf("Failed to build channel from Control Packet: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
response, err := chandler.OpenInbound(channel, opm)
|
||||
_, err = rc.handleChannelOpening(channel, response, err)
|
||||
if err != nil {
|
||||
|
|
|
@ -23,6 +23,10 @@ func TestChannelResultNotOpened(t *testing.T) {
|
|||
chatChannel := new(channels.ChatChannel)
|
||||
_, err := ccm.OpenChannelRequestFromPeer(2, chatChannel)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
cr := &Protocol_Data_Control.ChannelResult{
|
||||
ChannelIdentifier: proto.Int32(2),
|
||||
Opened: proto.Bool(false),
|
||||
|
@ -40,6 +44,10 @@ func TestChannelResultError(t *testing.T) {
|
|||
chatChannel := new(channels.ChatChannel)
|
||||
_, err := ccm.OpenChannelRequestFromPeer(2, chatChannel)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
cr := &Protocol_Data_Control.ChannelResult{
|
||||
ChannelIdentifier: proto.Int32(3),
|
||||
Opened: proto.Bool(false),
|
||||
|
|
|
@ -310,7 +310,7 @@ func checkCmdlineTorVersion(torCmd string) bool {
|
|||
}
|
||||
|
||||
// returns true if supplied version meets our min requirments
|
||||
// min requirment 0.3.5.x
|
||||
// min requirement: 0.3.5.x
|
||||
func minTorVersionReqs(torversion string) bool {
|
||||
torversions := strings.Split(torversion, ".") //eg: 0.3.4.8 or 0.3.5.1-alpha
|
||||
log.Debugf("torversions: %v", torversions)
|
||||
|
|
|
@ -26,6 +26,11 @@ func TestNegotiateInboundVersions(t *testing.T) {
|
|||
defer l.Close()
|
||||
go connect()
|
||||
conn, err := l.Accept()
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
_, err = NegotiateVersionInbound(conn)
|
||||
if err != nil {
|
||||
t.Errorf("Expected Success Got %v", err)
|
||||
|
@ -52,6 +57,11 @@ func TestBadProtcolLength(t *testing.T) {
|
|||
defer l.Close()
|
||||
go connect()
|
||||
conn, err := l.Accept()
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
_, err = NegotiateVersionInbound(conn)
|
||||
if err != io.ErrUnexpectedEOF {
|
||||
t.Errorf("Invalid Error Received. Expected ErrUnexpectedEOF. Got %v", err)
|
||||
|
@ -78,6 +88,11 @@ func TestNoSupportedVersions(t *testing.T) {
|
|||
defer l.Close()
|
||||
go connect()
|
||||
conn, err := l.Accept()
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
_, err = NegotiateVersionInbound(conn)
|
||||
if err != utils.VersionNegotiationError {
|
||||
t.Errorf("Invalid Error Received. Expected VersionNegotiationError. Got %v", err)
|
||||
|
@ -104,6 +119,11 @@ func TestInvalidVersionList(t *testing.T) {
|
|||
defer l.Close()
|
||||
go connect()
|
||||
conn, err := l.Accept()
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
_, err = NegotiateVersionInbound(conn)
|
||||
if err != utils.VersionNegotiationError {
|
||||
t.Errorf("Invalid Error Received. Expected VersionNegotiationError. Got %v", err)
|
||||
|
@ -130,6 +150,11 @@ func TestNoCompatibleVersions(t *testing.T) {
|
|||
defer l.Close()
|
||||
go connect()
|
||||
conn, err := l.Accept()
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Error setting up test: %v", err)
|
||||
}
|
||||
|
||||
_, err = NegotiateVersionInbound(conn)
|
||||
if err != utils.VersionNegotiationFailed {
|
||||
t.Errorf("Invalid Error Received. Expected VersionNegotiationFailed. Got %v", err)
|
||||
|
|
|
@ -12,4 +12,12 @@ echo ""
|
|||
echo "Linting:"
|
||||
|
||||
# Ignore wire packages as they are autogenerated
|
||||
go list ./... | grep -v "/wire/" | xargs golint
|
||||
go list ./... | grep -v "/wire/" | xargs golint
|
||||
|
||||
# ineffassign (https://github.com/gordonklaus/ineffassign)
|
||||
echo "Checking for ineffectual assignment of errors (unchecked errors...)"
|
||||
ineffassign .
|
||||
|
||||
# misspell (https://github.com/client9/misspell)
|
||||
echo "Checking for misspelled words..."
|
||||
go list ./... | grep -v "/wire/" | grep -v "/vendor/" | xargs misspell
|
Reference in New Issue