Sfoglia il codice sorgente

migrate to stand alone log and connectivity packages

pull/300/head
Dan Ballard 1 mese fa
parent
commit
12089d9fa4
41 ha cambiato i file con 105 aggiunte e 88 eliminazioni
  1. +2
    -2
      app/app.go
  2. +1
    -1
      app/appBridge.go
  3. +1
    -1
      app/appClient.go
  4. +2
    -2
      app/appService.go
  5. +2
    -2
      app/applets.go
  6. +2
    -2
      app/bots/servermon/main.go
  7. +3
    -3
      app/cli/main.go
  8. +1
    -1
      app/cwtchutil/main.go
  9. +3
    -3
      app/peer/alice/alice.go
  10. +3
    -3
      app/peer/bob/bob.go
  11. +2
    -2
      app/plugins/networkCheck.go
  12. +1
    -1
      app/plugins/plugin.go
  13. +1
    -1
      event/bridge/pipeBridge.go
  14. +1
    -1
      event/bridge/pipeBridge_test.go
  15. +1
    -1
      event/eventmanager_test.go
  16. +5
    -4
      go.mod
  17. +30
    -17
      go.sum
  18. +3
    -3
      model/group.go
  19. +2
    -1
      model/profile.go
  20. +1
    -1
      peer/cwtch_peer.go
  21. +2
    -2
      protocol/connections/connectionsmanager.go
  22. +2
    -2
      protocol/connections/connectsmanager_test.go
  23. +5
    -5
      protocol/connections/engine.go
  24. +1
    -1
      protocol/connections/peerapp.go
  25. +1
    -1
      protocol/connections/peerserverconnection.go
  26. +2
    -2
      protocol/connections/peerserverconnection_test.go
  27. +3
    -3
      server/app/main.go
  28. +1
    -1
      server/metrics/monitors.go
  29. +1
    -1
      server/send/server_send_channel.go
  30. +4
    -5
      server/server.go
  31. +1
    -1
      server/serverConfig.go
  32. +1
    -1
      server/storage/message_store.go
  33. +1
    -1
      storage/profile_store.go
  34. +1
    -1
      storage/profile_store_test.go
  35. +1
    -1
      storage/v0/file_enc.go
  36. +1
    -1
      storage/v0/stream_store.go
  37. +1
    -1
      storage/v1/file_enc.go
  38. +1
    -1
      storage/v1/file_store.go
  39. +1
    -1
      storage/v1/profile_store.go
  40. +1
    -1
      storage/v1/stream_store.go
  41. +6
    -3
      testing/cwtch_peer_server_integration_test.go

+ 2
- 2
app/app.go Vedi File

@@ -9,8 +9,8 @@ import (
"cwtch.im/cwtch/storage"
"cwtch.im/tapir/primitives"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"os"
"path"


+ 1
- 1
app/appBridge.go Vedi File

@@ -1,7 +1,7 @@
package app

import "cwtch.im/cwtch/event"
import "git.openprivacy.ca/openprivacy/libricochet-go/log"
import "git.openprivacy.ca/openprivacy/log"

const (
// DestApp should be used as a destination for IPC messages that are for the application itself an not a peer


+ 1
- 1
app/appClient.go Vedi File

@@ -6,7 +6,7 @@ import (
"cwtch.im/cwtch/peer"
"cwtch.im/cwtch/storage"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"path"
"strconv"
"sync"


+ 2
- 2
app/appService.go Vedi File

@@ -7,8 +7,8 @@ import (
"cwtch.im/cwtch/protocol/connections"
"cwtch.im/cwtch/storage"
"cwtch.im/tapir/primitives"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/log"
"path"
"strconv"
"sync"


+ 2
- 2
app/applets.go Vedi File

@@ -2,8 +2,8 @@ package app

import (
"cwtch.im/cwtch/event"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/log"
"sync"

"cwtch.im/cwtch/app/plugins"


+ 2
- 2
app/bots/servermon/main.go Vedi File

@@ -7,7 +7,7 @@ import (
"cwtch.im/cwtch/protocol/connections"
"errors"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"os"
"time"
)
@@ -41,7 +41,7 @@ func main() {

serverAddr := os.Args[1]

acn, err := connectivity.StartTor(".", "")
acn, err := tor.NewTorACN(".", "")
if err != nil {
fmt.Printf("Could not start tor: %v\n", err)
os.Exit(1)


+ 3
- 3
app/cli/main.go Vedi File

@@ -8,8 +8,8 @@ import (
"bytes"
"cwtch.im/cwtch/model"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"github.com/c-bata/go-prompt"
"golang.org/x/crypto/ssh/terminal"
"os"
@@ -281,7 +281,7 @@ func main() {
os.Exit(1)
}

acn, err := connectivity.StartTor(path.Join(usr.HomeDir, ".cwtch"), "")
acn, err := tor.NewTorACN(path.Join(usr.HomeDir, ".cwtch"), "")
if err != nil {
log.Errorf("\nError connecting to Tor: %v\n", err)
os.Exit(1)


+ 1
- 1
app/cwtchutil/main.go Vedi File

@@ -3,7 +3,7 @@ package main
import (
"errors"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
//"bufio"
//"cwtch.im/cwtch/storage"


+ 3
- 3
app/peer/alice/alice.go Vedi File

@@ -4,8 +4,8 @@ import (
app2 "cwtch.im/cwtch/app"
"cwtch.im/cwtch/app/utils"
"cwtch.im/cwtch/event"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"os"
"path"
)
@@ -16,7 +16,7 @@ func main() {
log.AddEverythingFromPattern("peer/alice")
log.SetLevel(log.LevelDebug)

acn, err := connectivity.StartTor(path.Join(".", ".cwtch"), "")
acn, err := tor.NewTorACN(path.Join(".", ".cwtch"), "")
if err != nil {
log.Errorf("\nError connecting to Tor: %v\n", err)
os.Exit(1)


+ 3
- 3
app/peer/bob/bob.go Vedi File

@@ -3,8 +3,8 @@ package main
import (
app2 "cwtch.im/cwtch/app"
"cwtch.im/cwtch/app/utils"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"os"
"path"
"time"
@@ -15,7 +15,7 @@ func main() {
// System Boilerplate, We need Tor Up and Running
log.AddEverythingFromPattern("peer/bob")
log.SetLevel(log.LevelDebug)
acn, err := connectivity.StartTor(path.Join(".", ".cwtch"), "")
acn, err := tor.NewTorACN(path.Join(".", ".cwtch"), "")
if err != nil {
log.Errorf("\nError connecting to Tor: %v\n", err)
os.Exit(1)


+ 2
- 2
app/plugins/networkCheck.go Vedi File

@@ -3,9 +3,9 @@ package plugins
import (
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/protocol/connections"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/policies"
"git.openprivacy.ca/openprivacy/log"
"sync"
"time"
)


+ 1
- 1
app/plugins/plugin.go Vedi File

@@ -2,7 +2,7 @@ package plugins

import (
"cwtch.im/cwtch/event"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/connectivity"
)

// PluginID is used as an ID for signaling plugin activities


+ 1
- 1
event/bridge/pipeBridge.go Vedi File

@@ -8,7 +8,7 @@ import (
"encoding/base64"
"encoding/binary"
"encoding/json"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
"sync"
"syscall"


+ 1
- 1
event/bridge/pipeBridge_test.go Vedi File

@@ -2,7 +2,7 @@ package bridge

import (
"cwtch.im/cwtch/event"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
"testing"
"time"


+ 1
- 1
event/eventmanager_test.go Vedi File

@@ -1,7 +1,7 @@
package event

import (
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"sync"
"testing"
"time"


+ 5
- 4
go.mod Vedi File

@@ -1,17 +1,18 @@
module cwtch.im/cwtch

require (
cwtch.im/tapir v0.1.14
git.openprivacy.ca/openprivacy/libricochet-go v1.0.10
cwtch.im/tapir v0.1.15
git.openprivacy.ca/openprivacy/connectivity v1.1.1
git.openprivacy.ca/openprivacy/libricochet-go v1.0.11
git.openprivacy.ca/openprivacy/log v1.0.0
github.com/c-bata/go-prompt v0.2.3
github.com/golang/protobuf v1.3.3
github.com/mattn/go-runewidth v0.0.8 // indirect
github.com/mattn/go-tty v0.0.3 // indirect
github.com/pkg/term v0.0.0-20190109203006-aa71e9d9e942 // indirect
github.com/struCoder/pidusage v0.1.3
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
golang.org/x/crypto v0.0.0-20200210191831-6ca56c2f2e2b
golang.org/x/net v0.0.0-20200202094626-16171245cfb2
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
)

go 1.13

+ 30
- 17
go.sum Vedi File

@@ -1,18 +1,23 @@
cwtch.im/tapir v0.1.14 h1:lg+reZNT998l++4Q4RQBLXYv3ukqWffhI0Wed9RSjuA=
cwtch.im/tapir v0.1.14/go.mod h1:QwERb982YIes9UOxDqIthm1HZ1xy0YQetD2+XxDbg9Y=
git.openprivacy.ca/openprivacy/libricochet-go v1.0.4/go.mod h1:yMSG1gBaP4f1U+RMZXN85d29D39OK5s8aTpyVRoH5FY=
git.openprivacy.ca/openprivacy/libricochet-go v1.0.10 h1:yxEqFJH4EdacPwGuOXx+QieYqIPDyzWP50H27EI7fxI=
git.openprivacy.ca/openprivacy/libricochet-go v1.0.10/go.mod h1:jJdxIwYDCcM4w4HAydeHuksPRTirUnyERAloPL0qtic=
cwtch.im/tapir v0.1.15 h1:XSCWOvjmNkzMT2IceFgTBXWGKtYfr3a8o+La1s10OhE=
cwtch.im/tapir v0.1.15/go.mod h1:HzezugpEx+nZ3LdyDsl0w6n45IJYnOt8uqldkLWmaqs=
git.openprivacy.ca/openprivacy/connectivity v1.1.0 h1:9PEeKuPdoIRYeA62BUkBW2BfK4KqKEXz1fvUxZoP4xs=
git.openprivacy.ca/openprivacy/connectivity v1.1.0/go.mod h1:4P8mirZZslKbo2zBrXXVjgEdqGwHo/6qoFBwFQW6d6E=
git.openprivacy.ca/openprivacy/connectivity v1.1.1 h1:hKxBOmxP7Jdu3K1BJ93mRtKNiWUoP6YHt/o2snE2Z0w=
git.openprivacy.ca/openprivacy/connectivity v1.1.1/go.mod h1:4P8mirZZslKbo2zBrXXVjgEdqGwHo/6qoFBwFQW6d6E=
git.openprivacy.ca/openprivacy/libricochet-go v1.0.11 h1:C7QFFzG0p5XKu0zcOIdLGwEpA9uU0BceBM7CfVK5D40=
git.openprivacy.ca/openprivacy/libricochet-go v1.0.11/go.mod h1:yTMps/ZpYS+BNBBvANsNAft28FXrBvFHQauMYNWPrwE=
git.openprivacy.ca/openprivacy/log v1.0.0 h1:Rvqm1weUdR4AOnJ79b1upHCc9vC/QF1rhSD2Um7sr1Y=
git.openprivacy.ca/openprivacy/log v1.0.0/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI=
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0=
github.com/c-bata/go-prompt v0.2.3 h1:jjCS+QhG/sULBhAaBdjb2PlMRVaKXQgn+4yzaauvs2s=
github.com/c-bata/go-prompt v0.2.3/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
github.com/cretz/bine v0.1.0 h1:1/fvhLE+fk0bPzjdO5Ci+0ComYxEMuB1JhM4X5skT3g=
github.com/cretz/bine v0.1.0/go.mod h1:6PF6fWAvYtwjRGkAuDEJeWNOv3a2hUouSP/yRYXmvHw=
github.com/cretz/bine v0.1.1-0.20200124154328-f9f678b84cca h1:Q2r7AxHdJwWfLtBZwvW621M3sPqxPc6ITv2j1FGsYpw=
github.com/cretz/bine v0.1.1-0.20200124154328-f9f678b84cca/go.mod h1:6PF6fWAvYtwjRGkAuDEJeWNOv3a2hUouSP/yRYXmvHw=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -25,6 +30,11 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is=
github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
@@ -45,26 +55,23 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/struCoder/pidusage v0.1.3 h1:pZcSa6asBE38TJtW0Nui6GeCjLTpaT/jAnNP7dUTLSQ=
github.com/struCoder/pidusage v0.1.3/go.mod h1:pWBlW3YuSwRl6h7R5KbvA4N8oOqe9LjaKW5CwT1SPjI=
go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
golang.org/x/crypto v0.0.0-20190128193316-c7b33c32a30b h1:Ib/yptP38nXZFMwqWSip+OKuMP9OkyDe3p+DssP8n9w=
golang.org/x/crypto v0.0.0-20190128193316-c7b33c32a30b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d h1:9FCpayM9Egr1baVnV1SX0H87m+XB0B8S0hAMi99X/3U=
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d h1:9FCpayM9Egr1baVnV1SX0H87m+XB0B8S0hAMi99X/3U=
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3 h1:ulvT7fqt0yHWzpJwI57MezWnYDVpCAYBVuYst/L+fAY=
golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a h1:aczoJ0HPNE92XKa7DrIzkNN6esOKO2TBwiiYoKcINhA=
golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200210191831-6ca56c2f2e2b h1:at/SwedEdvIO7WPO4V9Yn1a3MqdSqAo0p6trBocu5aA=
golang.org/x/crypto v0.0.0-20200210191831-6ca56c2f2e2b/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -76,3 +83,9 @@ golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfru
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 3
- 3
model/group.go Vedi File

@@ -5,8 +5,8 @@ import (
"cwtch.im/cwtch/protocol"
"errors"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"github.com/golang/protobuf/proto"
"golang.org/x/crypto/nacl/secretbox"
"io"
@@ -38,7 +38,7 @@ func NewGroup(server string) (*Group, error) {
group := new(Group)
group.LocalID = GenerateRandomID()

if utils.IsValidHostname(server) == false {
if tor.IsValidHostname(server) == false {
return nil, errors.New("Server is not a valid v3 onion")
}



+ 2
- 1
model/profile.go Vedi File

@@ -7,6 +7,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
"github.com/golang/protobuf/proto"
"golang.org/x/crypto/ed25519"
@@ -82,7 +83,7 @@ func GenerateNewProfile(name string) *Profile {
pub, priv, _ := ed25519.GenerateKey(rand.Reader)
p.Ed25519PublicKey = pub
p.Ed25519PrivateKey = priv
p.Onion = utils.GetTorV3Hostname(pub)
p.Onion = tor.GetTorV3Hostname(pub)

p.Contacts = make(map[string]*PublicProfile)
p.Contacts[p.Onion] = &p.PublicProfile


+ 1
- 1
peer/cwtch_peer.go Vedi File

@@ -8,7 +8,7 @@ import (
"encoding/base64"
"encoding/json"
"errors"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"strings"
"sync"
"time"


+ 2
- 2
protocol/connections/connectionsmanager.go Vedi File

@@ -2,8 +2,8 @@ package connections

import (
"cwtch.im/cwtch/protocol"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/log"

"sync"
)


+ 2
- 2
protocol/connections/connectsmanager_test.go Vedi File

@@ -1,11 +1,11 @@
package connections

import (
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/connectivity"
"testing"
)

func TestConnectionsManager(t *testing.T) {
// TODO We need to encapsulate connections behind a well defined interface for tesintg
NewConnectionsManager(connectivity.LocalProvider())
NewConnectionsManager(connectivity.NewLocalACN())
}

+ 5
- 5
protocol/connections/engine.go Vedi File

@@ -8,9 +8,9 @@ import (
"cwtch.im/tapir/networks/tor"
"cwtch.im/tapir/primitives"
"errors"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/libricochet-go/utils"
"git.openprivacy.ca/openprivacy/connectivity"
torProdider "git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/crypto/ed25519"
"sync"
"time"
@@ -111,14 +111,14 @@ func (e *engine) eventHandler() {
case event.StatusRequest:
e.eventManager.Publish(event.Event{EventType: event.ProtocolEngineStatus, EventID: ev.EventID})
case event.PeerRequest:
if utils.IsValidHostname(ev.Data[event.RemotePeer]) {
if torProdider.IsValidHostname(ev.Data[event.RemotePeer]) {
e.blocked.Store(ev.Data[event.RemotePeer], false)
go e.peerWithOnion(ev.Data[event.RemotePeer])
}
case event.RetryPeerRequest:
// This event allows engine to treat (automated) retry peering requests differently to user-specified
// peer events
if utils.IsValidHostname(ev.Data[event.RemotePeer]) {
if torProdider.IsValidHostname(ev.Data[event.RemotePeer]) {
go e.peerWithOnion(ev.Data[event.RemotePeer])
}
case event.InvitePeerToGroup:


+ 1
- 1
protocol/connections/peerapp.go Vedi File

@@ -5,7 +5,7 @@ import (
"cwtch.im/tapir"
"cwtch.im/tapir/applications"
"encoding/json"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
)

// PeerApp encapsulates the behaviour of a Cwtch Peer


+ 1
- 1
protocol/connections/peerserverconnection.go Vedi File

@@ -12,7 +12,7 @@ import (
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
"git.openprivacy.ca/openprivacy/libricochet-go/connection"
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/crypto/ed25519"
"sync"
"time"


+ 2
- 2
protocol/connections/peerserverconnection_test.go Vedi File

@@ -6,10 +6,10 @@ import (
"cwtch.im/cwtch/server/fetch"
"cwtch.im/cwtch/server/send"
"cwtch.im/tapir/primitives"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go"
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
"git.openprivacy.ca/openprivacy/libricochet-go/connection"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
identityOld "git.openprivacy.ca/openprivacy/libricochet-go/identity"
"golang.org/x/crypto/ed25519"
"net"
@@ -78,7 +78,7 @@ func TestPeerServerConnection(t *testing.T) {
onionAddr := identity.Hostname()

manager := event.NewEventManager()
engine := NewProtocolEngine(identity, priv, connectivity.LocalProvider(), manager, nil, nil)
engine := NewProtocolEngine(identity, priv, connectivity.NewLocalACN(), manager, nil, nil)

psc := NewPeerServerConnection(engine, "127.0.0.1:5451|"+onionAddr)
numcalls := 0


+ 3
- 3
server/app/main.go Vedi File

@@ -2,8 +2,8 @@ package main

import (
cwtchserver "cwtch.im/cwtch/server"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"os"
"path"
)
@@ -19,7 +19,7 @@ func main() {

serverConfig := cwtchserver.LoadConfig(configDir, serverConfigFile)

acn, err := connectivity.StartTor(path.Join(configDir, "tor"), "")
acn, err := tor.NewTorACN(path.Join(configDir, "tor"), "")
if err != nil {
log.Errorf("\nError connecting to Tor: %v\n", err)
os.Exit(1)


+ 1
- 1
server/metrics/monitors.go Vedi File

@@ -4,7 +4,7 @@ import (
"bufio"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/application"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"github.com/struCoder/pidusage"
"os"
"path"


+ 1
- 1
server/send/server_send_channel.go Vedi File

@@ -5,8 +5,8 @@ import (
"cwtch.im/cwtch/protocol/connections/spam"
"errors"
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/libricochet-go/wire/control"
"git.openprivacy.ca/openprivacy/log"
"github.com/golang/protobuf/proto"
)



+ 4
- 5
server/server.go Vedi File

@@ -6,12 +6,11 @@ import (
"cwtch.im/cwtch/server/metrics"
"cwtch.im/cwtch/server/send"
"cwtch.im/cwtch/server/storage"
"git.openprivacy.ca/openprivacy/connectivity"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/libricochet-go/application"
"git.openprivacy.ca/openprivacy/libricochet-go/channels"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/utils"

"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
"strconv"
"time"
@@ -71,7 +70,7 @@ func (s *Server) Run(acn connectivity.ACN, serverConfig Config) {
}
})

addressIdentity := utils.GetTorV3Hostname(s.config.PublicKey)
addressIdentity := tor.GetTorV3Hostname(s.config.PublicKey)
cwtchserver.Init(acn, "cwtch server for "+addressIdentity, s.config.Identity(), af, new(application.AcceptAllContactManager))
port := strconv.Itoa(application.RicochetPort)
log.Infof("cwtch server running on cwtch:%s\n", addressIdentity+".onion:"+port)


+ 1
- 1
server/serverConfig.go Vedi File

@@ -4,7 +4,7 @@ import (
"crypto/rand"
"encoding/json"
"git.openprivacy.ca/openprivacy/libricochet-go/identity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/crypto/ed25519"
"io/ioutil"
"path"


+ 1
- 1
server/storage/message_store.go Vedi File

@@ -6,7 +6,7 @@ import (
"cwtch.im/cwtch/server/metrics"
"encoding/json"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
"path"
"sync"


+ 1
- 1
storage/profile_store.go Vedi File

@@ -5,7 +5,7 @@ import (
"cwtch.im/cwtch/model"
"cwtch.im/cwtch/storage/v0"
"cwtch.im/cwtch/storage/v1"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"path"
"strconv"


+ 1
- 1
storage/profile_store_test.go Vedi File

@@ -6,7 +6,7 @@ import (
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/storage/v0"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"os"
"testing"
"time"


+ 1
- 1
storage/v0/file_enc.go Vedi File

@@ -3,7 +3,7 @@ package v0
import (
"crypto/rand"
"errors"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/crypto/nacl/secretbox"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/sha3"


+ 1
- 1
storage/v0/stream_store.go Vedi File

@@ -4,7 +4,7 @@ import (
"cwtch.im/cwtch/model"
"encoding/json"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"os"
"path"


+ 1
- 1
storage/v1/file_enc.go Vedi File

@@ -3,7 +3,7 @@ package v1
import (
"crypto/rand"
"errors"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/crypto/nacl/secretbox"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/sha3"


+ 1
- 1
storage/v1/file_store.go Vedi File

@@ -1,7 +1,7 @@
package v1

import (
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"os"
"path"


+ 1
- 1
storage/v1/profile_store.go Vedi File

@@ -4,7 +4,7 @@ import (
"cwtch.im/cwtch/event"
"cwtch.im/cwtch/model"
"encoding/json"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"os"
"path"


+ 1
- 1
storage/v1/stream_store.go Vedi File

@@ -4,7 +4,7 @@ import (
"cwtch.im/cwtch/model"
"encoding/json"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/log"
"io/ioutil"
"os"
"path"


+ 6
- 3
testing/cwtch_peer_server_integration_test.go Vedi File

@@ -10,8 +10,8 @@ import (
"cwtch.im/cwtch/protocol/connections"
cwtchserver "cwtch.im/cwtch/server"
"fmt"
"git.openprivacy.ca/openprivacy/libricochet-go/connectivity"
"git.openprivacy.ca/openprivacy/libricochet-go/log"
"git.openprivacy.ca/openprivacy/connectivity/tor"
"git.openprivacy.ca/openprivacy/log"
"golang.org/x/net/proxy"
"os"
"os/user"
@@ -114,7 +114,7 @@ func TestCwtchPeerIntegration(t *testing.T) {
log.ExcludeFromPattern("pipeBridge")
log.ExcludeFromPattern("tapir")
os.RemoveAll("tor")
acn, err := connectivity.StartTor(".", "")
acn, err := tor.NewTorACN(".", "")
if err != nil {
t.Fatalf("Could not start Tor: %v", err)
}
@@ -233,6 +233,9 @@ func TestCwtchPeerIntegration(t *testing.T) {
}
}

fmt.Println("Waiting for Bob to join connect to group server...")
waitForPeerGroupConnection(t, bob, groupID)

numGoRoutinesPostServerConnect := runtime.NumGoroutine()

// ***** Conversation *****


Loading…
Annulla
Salva