diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1ac33fcef60efb5b1b33aac1d21127c3897cf524..ed10c896c25c4df7300a9b73a053068f4bf44929 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,12 +32,15 @@ stages: - setup - test - build + - tag - trigger_integration - trigger_release_integration setup: stage: setup image: $DOCKER_IMAGE + except: + - tags script: - go mod vendor -v - go build ./... @@ -49,6 +52,8 @@ setup: test: stage: test image: $DOCKER_IMAGE + except: + - tags script: - GO111MODULE=off go get -u github.com/haya14busa/goverage - apt-get update @@ -74,6 +79,8 @@ test: build: stage: build image: $DOCKER_IMAGE + except: + - tags script: - mkdir -p release - go generate cmd/version.go @@ -83,15 +90,24 @@ build: - GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/client.win32 main.go - GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -ldflags '-w -s' -o release/client.darwin64 main.go - release/client.linux64 --version - - git remote add origin_tags git@gitlab.com:elixxir/client.git || true - - git tag $(release/client.linux64 -V | grep "Elixxir Client v"| cut -d ' ' -f3) -f - - git push origin_tags -f --tags artifacts: paths: - release/ + +tag: + stage: tag + only: + - master + image: $DOCKER_IMAGE + script: + - git remote add origin_tags git@gitlab.com:elixxir/client.git || true + - git tag $(release/client.linux64 -V | grep "Elixxir Client v"| cut -d ' ' -f3) -f + - git push origin_tags -f --tags #bindings: # stage: build +# except: +# - tags # tags: # - ios # script: diff --git a/api/client.go b/api/client.go index 36cf6203ebc06a89af8f6416fb95de673f655087..416c6e0feba27ae902fca569ebf15cf86d2cd8a2 100644 --- a/api/client.go +++ b/api/client.go @@ -304,7 +304,7 @@ func (cl *Client) InitListeners() error { // Logs in user and sets session on client object // returns the nickname or error if login fails func (cl *Client) StartMessageReceiver(callback func(error)) error { - pollWaitTimeMillis := 1000 * time.Millisecond + pollWaitTimeMillis := 500 * time.Millisecond // TODO Don't start the message receiver if it's already started. // Should be a pretty rare occurrence except perhaps for mobile. receptionGateway := id.NewNodeFromBytes(cl.ndf.Nodes[len(cl.ndf.Nodes)-1].ID).NewGateway() diff --git a/api/connect.go b/api/connect.go index 597f29020897f781b38776bee8801e63075850fc..d371dcb84065258c4539ebe248c9aefe6053e879 100644 --- a/api/connect.go +++ b/api/connect.go @@ -33,6 +33,7 @@ func (cl *Client) InitNetwork() error { } runPermissioning := err != ErrNoPermissioning + if runPermissioning { globals.Log.DEBUG.Printf("Setting up permissioning...") err = cl.setupPermissioning() @@ -62,6 +63,7 @@ func (cl *Client) DisableTls() { // Begin client version checks via registration server func (cl *Client) setupPermissioning() error { + //Get remote version and update ver, err := cl.receptionManager.GetRemoteVersion() if err != nil { @@ -78,6 +80,7 @@ func (cl *Client) setupPermissioning() error { cl.ndf = def } + globals.Log.DEBUG.Printf("Local version: %v; Remote version: %v", globals.SEMVER, cl.GetRegistrationVersion()) diff --git a/cmd/root.go b/cmd/root.go index aa952f712c9733ab80aadc63db38896bc2147fb6..7edd3e7449d5e3f8e3e83b3ceac393871f639262 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -408,12 +408,15 @@ var rootCmd = &cobra.Command{ cb := func(err error) { globals.Log.ERROR.Print(err) } + err = client.InitListeners() if err != nil { globals.Log.FATAL.Panicf("Could not initialize receivers: %s\n", err) } + err = client.StartMessageReceiver(cb) + if err != nil { globals.Log.FATAL.Panicf("Could Not start message reciever: %s\n", err) } @@ -466,7 +469,7 @@ var rootCmd = &cobra.Command{ wireOut := api.FormatTextMessage(message) for i := uint(0); i < messageCnt; i++ { - fmt.Printf("Sending Message to %d, %v: %s\n", destinationUserId, + fmt.Printf("Sending Message to %s, %v: %s\n", base64.StdEncoding.EncodeToString(recipientId.Bytes()), recipientNick, message) if i != 0 { time.Sleep(1 * time.Second) diff --git a/globals/version.go b/globals/version.go index 0d8e93c560ecf786637ddb63cd0cd4c140b87c75..5135ae6151f78ac1c06ea2d0936ac9523e66be89 100644 --- a/globals/version.go +++ b/globals/version.go @@ -1,14 +1,8 @@ -//////////////////////////////////////////////////////////////////////////////// -// Copyright © 2020 Privategrity Corporation / -// / -// All rights reserved. / -//////////////////////////////////////////////////////////////////////////////// - // Code generated by go generate; DO NOT EDIT. // This file was generated by robots at -// 2020-02-06 14:09:54.442503 -0800 PST m=+0.007064579 +// 2020-02-06 15:07:00.1145694 -0800 STD m=+0.048066801 package globals -const GITVERSION = `368d13e Merge branch 'XX-1807/Version-Tagging' into 'release'` +const GITVERSION = `e77ca12 Merge branch 'authClient' into 'release'` const SEMVER = "1.1.1" const GLIDEDEPS = `` diff --git a/go.mod b/go.mod index c5b3ecf94b689cda3991e88517608066c29aa843..fcf1ec6ffd384942f9e08a1e1fb24b0ac2b37e8d 100644 --- a/go.mod +++ b/go.mod @@ -16,11 +16,12 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.6.2 - gitlab.com/elixxir/comms v0.0.0-20200130173653-721e14282756 - gitlab.com/elixxir/crypto v0.0.0-20200205173613-ec404dbd2ad2 + gitlab.com/elixxir/comms v0.0.0-20200206201144-aa6e356b3770 + gitlab.com/elixxir/crypto v0.0.0-20200206203107-b8926242da23 gitlab.com/elixxir/primitives v0.0.0-20200131183153-e93c6b75019f - golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 + golang.org/x/crypto v0.0.0-20200206161412-a0c6ece9d31a golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect google.golang.org/genproto v0.0.0-20200205142000-a86caf926a67 // indirect + google.golang.org/grpc v1.27.1 // indirect gopkg.in/ini.v1 v1.52.0 // indirect ) diff --git a/go.sum b/go.sum index ec8c0c8babd686ef9715737653b5a3d4d2c533d5..0c7f60f8ac2d037a3b3403196ce10460aa3c8877 100644 --- a/go.sum +++ b/go.sum @@ -228,12 +228,12 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -gitlab.com/elixxir/comms v0.0.0-20200130173653-721e14282756 h1:RYVhlBpxk2BmTPh/LBHHAdFkrfxOyD5TCsNfGphJL3w= -gitlab.com/elixxir/comms v0.0.0-20200130173653-721e14282756/go.mod h1:DblaR0msnWpNGzNK2fXvXbfGZQNPH4KPiBl4YkkGF4Y= +gitlab.com/elixxir/comms v0.0.0-20200206201144-aa6e356b3770 h1:zYoqjUaa94+uqznpNb6UT+6aiDNBBfva4LmwFeq+rzU= +gitlab.com/elixxir/comms v0.0.0-20200206201144-aa6e356b3770/go.mod h1:DblaR0msnWpNGzNK2fXvXbfGZQNPH4KPiBl4YkkGF4Y= gitlab.com/elixxir/crypto v0.0.0-20191121235352-86d305a9b253 h1:BqgqJ0mLANRjhAFLvGAcB5AWdgAnFZhsGx0qTk5G+3Y= gitlab.com/elixxir/crypto v0.0.0-20191121235352-86d305a9b253/go.mod h1:+46Zj/NE6JEkXExYnzdvvDokPpDbA+fJsRszvrezK9k= -gitlab.com/elixxir/crypto v0.0.0-20200205173613-ec404dbd2ad2 h1:9i1dWxx/zMAFDM3aM1WaT/AmeJ5d2mIky18fwRSLs6U= -gitlab.com/elixxir/crypto v0.0.0-20200205173613-ec404dbd2ad2/go.mod h1:wWulHuSqxiGhvasduZrtyTTqy+7y5ebe440GdORhzig= +gitlab.com/elixxir/crypto v0.0.0-20200206203107-b8926242da23 h1:J9MKdOxLGzDZoLy2Q0CAxPlPjSH+k4NG3JhgvatAZjo= +gitlab.com/elixxir/crypto v0.0.0-20200206203107-b8926242da23/go.mod h1:wWulHuSqxiGhvasduZrtyTTqy+7y5ebe440GdORhzig= gitlab.com/elixxir/primitives v0.0.0-20191028233752-882c08b8f095 h1:fnRh0PUwgy0qlWM7xMdk2w5MXh7gvQ0v/xyedn2gbcY= gitlab.com/elixxir/primitives v0.0.0-20191028233752-882c08b8f095/go.mod h1:+UiRRWzNpl/WoWUuQtJSoimfXImJAJ5lrrmg0pQKY3g= gitlab.com/elixxir/primitives v0.0.0-20200106183011-a68f1e6f188e/go.mod h1:g9v3S34ZUeqGRiOTV7esByK8a5TovJ3YgTv/328ny6w= @@ -259,6 +259,8 @@ golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200117160349-530e935923ad/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 h1:+ELyKg6m8UBf0nPFSqD0mi7zUfwPyXo23HNjMnXPz7w= 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/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= @@ -367,6 +369,8 @@ google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/io/receive.go b/io/receive.go index ae17b8c481ba1797b34881459576741a68d7e462..49c1cddd7f888bc3785a27aa64eeb0adbec425ad 100644 --- a/io/receive.go +++ b/io/receive.go @@ -48,16 +48,16 @@ func (rm *ReceptionManager) MessageReceiver(session user.Session, delay time.Dur var encryptedMessages []*format.Message globals.Log.DEBUG.Printf("Gateway Polling for Message Reception Begun") + receptionTicker := time.NewTicker(delay) for { - // TODO: replace timer with ticker - timerDelay := time.NewTimer(delay) + NumChecks++ select { case <-quit: globals.Log.DEBUG.Printf("Stopped message receiver\n") return - case <-timerDelay.C: + case <-receptionTicker.C: //check if a report on the polling status is due, report to logs if //it is @@ -72,7 +72,6 @@ func (rm *ReceptionManager) MessageReceiver(session user.Session, delay time.Dur NumChecks++ var err error - encryptedMessages, err = rm.receiveMessagesFromGateway(session, &pollingMessage, receptionHost) if err != nil { diff --git a/keyStore/recieveKeyManagerBuffer.go b/keyStore/recieveKeyManagerBuffer.go index 6fc4a69e34519a4d48173fd2c0148e6dafb53f60..334b5c795b7dc48e8583a31676918a0353a56cef 100644 --- a/keyStore/recieveKeyManagerBuffer.go +++ b/keyStore/recieveKeyManagerBuffer.go @@ -65,7 +65,7 @@ func (rkmb *ReceptionKeyManagerBuffer) GobEncode() ([]byte, error) { var bufferSlice []*KeyManager for i := 0; i < len(rkmb.managers); i++ { - j := ((rkmb.loc + i) % len(rkmb.managers)) + j := (rkmb.loc + i) % len(rkmb.managers) if rkmb.managers[j] != nil { bufferSlice = append(bufferSlice, rkmb.managers[j]) } @@ -119,7 +119,7 @@ func (rkmb *ReceptionKeyManagerBuffer) GobDecode(in []byte) error { rkmb.loc = anon.Loc for i := 0; i < len(anon.Managers); i++ { - j := ((anon.Loc + i) % len(rkmb.managers)) + j := (anon.Loc + i) % len(rkmb.managers) rkmb.managers[j] = anon.Managers[i] }