From 23faebf2a165d1f1c9da939e596bffb3ddfaddda Mon Sep 17 00:00:00 2001 From: jul Date: Tue, 27 Apr 2021 16:51:45 +0200 Subject: [PATCH 01/13] Build: Tidied scripts, added templates for service and version --- .travis.yml | 2 - go.mod | 12 +- go.sum | 288 ++++++++++++++++++++++- scripts/build.sh | 42 ++-- scripts/createsecrets.sh | 2 - scripts/deploy.sh | 11 - scripts/generate.sh | 1 - scripts/run.sh | 10 +- scripts/service_template.txt | 13 + scripts/test.sh | 4 +- scripts/version.sh | 15 ++ scripts/version_template.txt | 5 + src/peach_client_coordinator/api_test.go | 175 -------------- src/peach_discord_client/version.go | 2 +- src/peach_launcher/version.go | 2 +- 15 files changed, 351 insertions(+), 233 deletions(-) delete mode 100644 scripts/createsecrets.sh delete mode 100755 scripts/deploy.sh delete mode 100755 scripts/generate.sh create mode 100644 scripts/service_template.txt create mode 100644 scripts/version.sh create mode 100644 scripts/version_template.txt delete mode 100644 src/peach_client_coordinator/api_test.go diff --git a/.travis.yml b/.travis.yml index 4e6e988..70e29c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,13 +10,11 @@ jobs: include: - stage: Test script: - - go get golang.org/x/tools/cmd/stringer - go mod download - go generate ./... - ./scripts/test.sh - stage: Deploy script: - - go get golang.org/x/tools/cmd/stringer - go mod download - go generate ./... - ./scripts/build.sh diff --git a/go.mod b/go.mod index 4c1ad5a..f70adf7 100644 --- a/go.mod +++ b/go.mod @@ -4,16 +4,22 @@ go 1.13 require ( github.com/alessio/shellescape v1.4.1 + github.com/golang/protobuf v1.5.2 // indirect github.com/gorilla/mux v1.8.0 github.com/gorilla/websocket v1.4.2 github.com/hako/durafmt v0.0.0-20210316092057-3a2c319c1acd + github.com/jackc/pgproto3/v2 v2.0.7 // indirect github.com/jackc/pgx/v4 v4.11.0 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 github.com/zmb3/spotify v1.1.2 - golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d - golang.org/x/text v0.3.5 - gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 + golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b // indirect + golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 // indirect + golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78 + golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 // indirect + golang.org/x/text v0.3.6 + google.golang.org/appengine v1.6.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index 9f7d48b..6140766 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,38 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= @@ -31,8 +63,12 @@ github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= @@ -54,13 +90,18 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= @@ -78,20 +119,58 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= @@ -128,6 +207,7 @@ github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2p github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= @@ -158,6 +238,8 @@ github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1: github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8= github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= +github.com/jackc/pgproto3/v2 v2.0.7 h1:6Pwi1b3QdY65cuv6SyVO0FgPd5J3Bl7wf/nQQjinHMA= +github.com/jackc/pgproto3/v2 v2.0.7/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= @@ -187,6 +269,8 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -331,6 +415,9 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1 github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/zmb3/spotify v1.1.2 h1:X/t7NUhhPuMqga4C2ZfoM3ZSaRanEInSroVst5Ztg2M= github.com/zmb3/spotify v1.1.2/go.mod h1:GD7AAEMUJVYc2Z7p2a2S0E3/5f/KxM/vOnErNr4j+Tw= @@ -338,7 +425,11 @@ go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= @@ -355,21 +446,47 @@ golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b h1:7mWr3k41Qtv8XlltBkDkl8LoP3mpSgBW8BUoxtEdbXg= +golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -382,22 +499,48 @@ golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6 h1:0PC75Fz/kyMGhL0e1QnypqK2kQMqKt9csD1GnMJR+Zk= +golang.org/x/net v0.0.0-20210423184538-5f58ad60dda6/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78 h1:rPRtHfUb0UKZeZ6GH4K4Nt4YRbE9V1u+QZX5upZXqJQ= +golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/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/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -408,27 +551,53 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -436,42 +605,144 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 h1:DnSr2mCsxyCE6ZgIkmcWUQY2R5cH/6wL7eIxEmQOMSE= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= +google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61 h1:8ajkpB4hXVftY5ko905id+dOnmorcS2CHNxxHLLDcFM= -gopkg.in/alessio/shellescape.v1 v1.0.0-20170105083845-52074bc9df61/go.mod h1:IfMagxm39Ys4ybJrDb7W3Ob8RwxftP0Yy+or/NVz1O8= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -489,9 +760,18 @@ gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/scripts/build.sh b/scripts/build.sh index 33d6ebe..25b6cf9 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -3,11 +3,21 @@ build () { then sudo systemctl stop peach fi + printf "Building project\n" mkdir -p build || fail + mkdir -p scripts/hash || fail + if [[ $args == *"f"* ]] + then + rm -r scripts/hash || fail + mkdir -p scripts/hash || fail + fi printf "Copying files..." cp launchcfg.json build/launchcfg.json + echo "s/\${version}/$version/" > ./scripts/replace.txt + sed -f ./scripts/replace.txt ./scripts/service_template.txt > build/peach.service + rm ./scripts/replace.txt printf "done\n" printf "Collecting dependencies..." @@ -35,7 +45,6 @@ build () { } hash () { - mkdir -p scripts/hash || fail newhash=$(find ./src/$1 -type f -print0 | xargs -0 sha1sum) echo $newhash > scripts/hash/$1_new.hash newhash=$( src/peach_discord_client/version.go + echo "s/\${version}/$version/" > ./scripts/replace.txt + sed -f ./scripts/replace.txt ./scripts/version_template.txt > src/peach_discord_client/version.go + rm ./scripts/replace.txt + go build -o build/discordclient-$version.exe ./src/peach_discord_client || fail printf "\nDone building discord client\n" storehash "peach_discord_client" @@ -127,10 +136,9 @@ buildlauncher() { printf "\nCompiling..." - printf "package main\n -// VERSION represents the release the bot is currently running on. -// This file is automatically generated by the build script. Do not edit. -const VERSION = \"$version\"" > src/peach_launcher/version.go + echo "s/\${version}/$version/" > ./scripts/replace.txt + sed -f ./scripts/replace.txt ./scripts/version_template.txt > src/peach_launcher/version.go + rm ./scripts/replace.txt go build -o build/launcher-$version.exe ./src/peach_launcher || fail printf "\nDone building launcher\n" @@ -147,23 +155,11 @@ if [[ $args == "-"* ]] then if [[ $args == *"h"* ]] then - printf "Builds the project\nUsage: ./build.sh [OPTIONS]\n\nOptions:\n -h prints this page\n -i installs built project\n -d installs dependencies\n -r restarts the system service\n" + printf "Builds the project\nUsage: ./build.sh [OPTIONS]\n\nOptions:\n -h prints this page\n -f ignore cache and build all modules\n -i installs built project\n -d installs dependencies\n -r restarts the system service\n" exit fi fi -version=$(git describe --tags) -branch=$(git rev-parse --abbrev-ref HEAD) -if [[ "$branch" == "master" ]]; then - branch="" -else - branch="-$branch" -fi -version=${version%-*-*} -version="$version$branch" - -if [[ "$TRAVIS_TAG" != "" ]]; then - version="$TRAVIS_TAG" -fi +version=$(./scripts/version.sh) build \ No newline at end of file diff --git a/scripts/createsecrets.sh b/scripts/createsecrets.sh deleted file mode 100644 index 63a700e..0000000 --- a/scripts/createsecrets.sh +++ /dev/null @@ -1,2 +0,0 @@ -kubectl create secret generic database --from-file=./secrets/DATABASE -kubectl create secret generic clustersecret --from-file=./secrets/CLUSTERSECRET \ No newline at end of file diff --git a/scripts/deploy.sh b/scripts/deploy.sh deleted file mode 100755 index c1b247b..0000000 --- a/scripts/deploy.sh +++ /dev/null @@ -1,11 +0,0 @@ -echo "Building discord client..." -go build ./src/peach_discord_client -echo "." -echo "." -echo "Restarting service..." -systemctl --user restart peach -echo "." -echo "." -echo "Done :)" -systemctl --user status peach -journalctl --user -u peach --follow --since=now \ No newline at end of file diff --git a/scripts/generate.sh b/scripts/generate.sh deleted file mode 100755 index 286a3bf..0000000 --- a/scripts/generate.sh +++ /dev/null @@ -1 +0,0 @@ -go generate ./src/... \ No newline at end of file diff --git a/scripts/run.sh b/scripts/run.sh index cc3fd8e..ee8331d 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -8,15 +8,7 @@ function on_exit() trap "on_exit" 2 echo "Running launcher" -version=$(git describe --tags) -branch=$(git rev-parse --abbrev-ref HEAD) -if [[ "$branch" == "master" ]]; then - branch="" -else - branch="-$branch" -fi -version=${version%-*-*} -version="$version$branch" +version=$(./scripts/version.sh) cd build ./launcher-$version.exe \ No newline at end of file diff --git a/scripts/service_template.txt b/scripts/service_template.txt new file mode 100644 index 0000000..5a51b69 --- /dev/null +++ b/scripts/service_template.txt @@ -0,0 +1,13 @@ +[Unit] +Description=Peach Discord Bot +After=network.target + +[Service] +Type=simple +User=peach +ExecStart=/home/peach/${version}-launcher.exe +Restart=always +WorkingDirectory=/home/peach + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index 4a3eea1..3738eb7 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1 +1,3 @@ -go test -v ./src/... \ No newline at end of file +go test -v ./src/peach_discord_client +go test -v ./src/peach_client_coordinator +go test -v ./src/peach_launcher \ No newline at end of file diff --git a/scripts/version.sh b/scripts/version.sh new file mode 100644 index 0000000..1daf1aa --- /dev/null +++ b/scripts/version.sh @@ -0,0 +1,15 @@ +if [[ "$TRAVIS_TAG" != "" ]]; then + version="$TRAVIS_TAG" +else + version=$(git describe --tags) + branch=$(git rev-parse --abbrev-ref HEAD) + if [[ "$branch" == "master" ]]; then + branch="" + else + branch="-$branch" + fi + version=${version%-*-*} + version="$version$branch" +fi + +echo $version \ No newline at end of file diff --git a/scripts/version_template.txt b/scripts/version_template.txt new file mode 100644 index 0000000..30875d3 --- /dev/null +++ b/scripts/version_template.txt @@ -0,0 +1,5 @@ +package main + +// VERSION represents the release the bot is currently running on. +// This file is automatically generated by the build script. Do not edit. +const VERSION = "${version}" \ No newline at end of file diff --git a/src/peach_client_coordinator/api_test.go b/src/peach_client_coordinator/api_test.go deleted file mode 100644 index cc6fef8..0000000 --- a/src/peach_client_coordinator/api_test.go +++ /dev/null @@ -1,175 +0,0 @@ -package main - -import ( - log "github.com/sirupsen/logrus" -) - -func init() { - log.SetLevel(log.ErrorLevel) -} - -/* -// TestGetShard ensures the /getshard path works properly. -func TestGetShard(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 2 - resetShardCount(wantedShardCount, true) - w := httptest.NewRecorder() - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/getshard", getShard).Methods(http.MethodGet) - - // Run request - r.ServeHTTP(w, httptest.NewRequest("GET", "/api/v1/getshard", nil)) - - // Evaluate results - assert.Equal(http.StatusOK, w.Code) - assert.Equal(fmt.Sprintf(`{"total_shards": %v, "assigned_shard": 0, "gatewayurl": ""}`, wantedShardCount), w.Body.String()) -} - -// TestReserveShard ensures the /reserveshard path works properly. -func TestReserveShard(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 2 - resetShardCount(wantedShardCount, true) - w := httptest.NewRecorder() - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/reserveshard", reserveShard).Methods(http.MethodPost) - - // Run request - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=0", nil)) - - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) -} - -// TestGetAndReserveMultipleShards ensures that shards get assigned and reserved correctly. -func TestGetAndReserveMultipleShards(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 3 - resetShardCount(wantedShardCount, true) - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/reserveshard", reserveShard).Methods(http.MethodPost) - api.HandleFunc("/getshard", getShard).Methods(http.MethodGet) - - // Get Shard 0 - w := httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("GET", "/api/v1/getshard", nil)) - // Evaluate results - assert.Equal(http.StatusOK, w.Code) - assert.Equal(fmt.Sprintf(`{"total_shards": %v, "assigned_shard": 0, "gatewayurl": ""}`, wantedShardCount), w.Body.String()) - - // Reserve Shard 0 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=0", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) - - // Get Shard 1 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("GET", "/api/v1/getshard", nil)) - // Evaluate results - assert.Equal(http.StatusOK, w.Code) - assert.Equal(fmt.Sprintf(`{"total_shards": %v, "assigned_shard": 1, "gatewayurl": ""}`, wantedShardCount), w.Body.String()) - - // Reserve Shard 1 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=1", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) - - // Get Shard 2 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("GET", "/api/v1/getshard", nil)) - // Evaluate results - assert.Equal(http.StatusOK, w.Code) - assert.Equal(fmt.Sprintf(`{"total_shards": %v, "assigned_shard": 2, "gatewayurl": ""}`, wantedShardCount), w.Body.String()) - - // Reserve Shard 2 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=2", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) -} - -// TestReserveOutOfBounds ensures that nonexistant shards can not get reserved -func TestReserveOutOfBounds(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 2 - resetShardCount(wantedShardCount, true) - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/reserveshard", reserveShard).Methods(http.MethodPost) - api.HandleFunc("/getshard", getShard).Methods(http.MethodGet) - - // Reserve Shard 2 (too high) - w := httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=2", nil)) - // Evaluate results - assert.Equal(http.StatusNotAcceptable, w.Code) - - // Reserve Shard -1 (too low) - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=-1", nil)) - // Evaluate results - assert.Equal(http.StatusNotAcceptable, w.Code) -} - -func TestAllShardsAssigned(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 2 - resetShardCount(wantedShardCount, true) - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/reserveshard", reserveShard).Methods(http.MethodPost) - api.HandleFunc("/getshard", getShard).Methods(http.MethodGet) - - // Reserve Shard 0 - w := httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=0", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) - - // Reserve Shard 1 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=1", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) - - // Get Shard (All assigned) - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("GET", "/api/v1/getshard", nil)) - // Evaluate results - assert.Equal(http.StatusNoContent, w.Code) -} - -func TestShardAlreadyAssigned(t *testing.T) { - // Test setup - assert := assert.New(t) - wantedShardCount := 2 - resetShardCount(wantedShardCount, true) - r := mux.NewRouter() - api := r.PathPrefix("/api/v1").Subrouter() - api.HandleFunc("/reserveshard", reserveShard).Methods(http.MethodPost) - api.HandleFunc("/getshard", getShard).Methods(http.MethodGet) - - // Reserve Shard 0 - w := httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=0", nil)) - // Evaluate results - assert.Equal(http.StatusCreated, w.Code) - - // Reserve Shard 0 - w = httptest.NewRecorder() - r.ServeHTTP(w, httptest.NewRequest("POST", "/api/v1/reserveshard?shardid=0", nil)) - // Evaluate results - assert.Equal(http.StatusNotAcceptable, w.Code) -} -*/ diff --git a/src/peach_discord_client/version.go b/src/peach_discord_client/version.go index c4ba502..7bdb388 100644 --- a/src/peach_discord_client/version.go +++ b/src/peach_discord_client/version.go @@ -2,4 +2,4 @@ package main // VERSION represents the release the bot is currently running on. // This file is automatically generated by the build script. Do not edit. -const VERSION = "v0.4.4-alpha-develop" \ No newline at end of file +const VERSION = "" diff --git a/src/peach_launcher/version.go b/src/peach_launcher/version.go index c4ba502..7bdb388 100644 --- a/src/peach_launcher/version.go +++ b/src/peach_launcher/version.go @@ -2,4 +2,4 @@ package main // VERSION represents the release the bot is currently running on. // This file is automatically generated by the build script. Do not edit. -const VERSION = "v0.4.4-alpha-develop" \ No newline at end of file +const VERSION = "" From 5fa74045109f86b0f810f447259ace6dd5d36022 Mon Sep 17 00:00:00 2001 From: jul Date: Tue, 27 Apr 2021 17:11:31 +0200 Subject: [PATCH 02/13] Travis: Removed go generate step --- .travis.yml | 2 -- go.sum | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70e29c4..fdd48a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,10 @@ jobs: - stage: Test script: - go mod download - - go generate ./... - ./scripts/test.sh - stage: Deploy script: - go mod download - - go generate ./... - ./scripts/build.sh deploy: provider: releases diff --git a/go.sum b/go.sum index 6140766..3646481 100644 --- a/go.sum +++ b/go.sum @@ -486,6 +486,7 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -647,6 +648,7 @@ golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From b9565b1d7add8544ee960bd305e28945fa60e432 Mon Sep 17 00:00:00 2001 From: jul Date: Tue, 27 Apr 2021 17:15:41 +0200 Subject: [PATCH 03/13] Travis: Removed superfluous go mod download step Travis already downloads dependencies in the install phase automatically --- .travis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index fdd48a6..9dd9086 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,13 +9,9 @@ go: jobs: include: - stage: Test - script: - - go mod download - - ./scripts/test.sh + script: ./scripts/test.sh - stage: Deploy - script: - - go mod download - - ./scripts/build.sh + script: ./scripts/build.sh deploy: provider: releases token: From 5d9409d64ed73458ac91544e0ffb1ddfc4e96dab Mon Sep 17 00:00:00 2001 From: jul Date: Tue, 27 Apr 2021 17:20:28 +0200 Subject: [PATCH 04/13] Travis: Make a build during testing, only run deploy on master --- .travis.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9dd9086..5782d87 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,9 +9,13 @@ go: jobs: include: - stage: Test - script: ./scripts/test.sh + script: + - ./scripts/test.sh + - ./scripts/build.sh - stage: Deploy - script: ./scripts/build.sh + if: branch = master + script: + - ./scripts/build.sh deploy: provider: releases token: From 1d1bdb7778f70d4eaa677e43867a057907185ac4 Mon Sep 17 00:00:00 2001 From: jul Date: Tue, 27 Apr 2021 18:46:29 +0200 Subject: [PATCH 05/13] Docs: Update email in CoC --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 9c970a2..9108950 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -55,7 +55,7 @@ further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at floofyjul@gmail.com. All +reported by contacting the project team at jul@jul.xyz. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. From 3d2e795176216783c990b16198954c0639bb3b1d Mon Sep 17 00:00:00 2001 From: jul Date: Fri, 30 Apr 2021 19:00:21 +0200 Subject: [PATCH 06/13] Build: Update location of service file --- peach.service | 13 ------------- scripts/build.sh | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 peach.service diff --git a/peach.service b/peach.service deleted file mode 100644 index 4162576..0000000 --- a/peach.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Peach Discord Bot -After=network.target - -[Service] -Type=simple -User=peach -ExecStart=/home/peach/launcher.exe -Restart=always -WorkingDirectory=/home/peach - -[Install] -WantedBy=default.target \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 25b6cf9..8be5d26 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -35,7 +35,7 @@ build () { then waittillstopped cp build/. /home/peach -r || fail - cp peach.service /etc/systemd/system/peach.service + cp build/peach.service /etc/systemd/system/peach.service sudo systemctl daemon-reload fi if [[ $args == *"r"* ]] From 08ac5a85eb1e8ef8b25a3e52f1c40afdecc3394a Mon Sep 17 00:00:00 2001 From: jul Date: Sat, 1 May 2021 17:26:19 +0200 Subject: [PATCH 07/13] Rename coordinator --- .gitignore | 18 +-- scripts/build.sh | 19 ++- scripts/coordinator_service_template.txt | 13 ++ ...late.txt => launcher_service_template.txt} | 2 +- scripts/test.sh | 2 +- .../database.go | 0 .../database_structs.go | 0 .../main.go | 6 +- .../paths.go | 0 .../queries.go | 0 .../shard_managing.go | 0 .../structs.go | 0 .../tokens.go | 0 src/peach_discord_client/client.go | 123 ++---------------- src/peach_discord_client/coordinator.go | 109 ++++++++++++++++ src/peach_discord_client/eventhandlers.go | 6 +- src/peach_discord_client/main.go | 4 +- src/peach_discord_client/settings.go | 6 +- src/peach_discord_client/structs.go | 4 +- 19 files changed, 165 insertions(+), 147 deletions(-) create mode 100644 scripts/coordinator_service_template.txt rename scripts/{service_template.txt => launcher_service_template.txt} (78%) rename src/{peach_client_coordinator => peach_coordinator}/database.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/database_structs.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/main.go (91%) rename src/{peach_client_coordinator => peach_coordinator}/paths.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/queries.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/shard_managing.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/structs.go (100%) rename src/{peach_client_coordinator => peach_coordinator}/tokens.go (100%) create mode 100644 src/peach_discord_client/coordinator.go diff --git a/.gitignore b/.gitignore index c6db8f1..be5563f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,11 @@ .vscode -notes -secrets -devsecrets -vendor -*.exe -build -scripts/hash +*.pem + +**/vendor node_modules -launchcfg.json -scripts/getguildsettings.sql -scripts/getusersettings.sql +build +scripts/hash -TODO +launchcfg.json +TODO \ No newline at end of file diff --git a/scripts/build.sh b/scripts/build.sh index 8be5d26..3e6bd76 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -5,6 +5,8 @@ build () { fi printf "Building project\n" + + # make directories for build and hash files mkdir -p build || fail mkdir -p scripts/hash || fail if [[ $args == *"f"* ]] @@ -15,9 +17,14 @@ build () { printf "Copying files..." cp launchcfg.json build/launchcfg.json + + # generate service files echo "s/\${version}/$version/" > ./scripts/replace.txt - sed -f ./scripts/replace.txt ./scripts/service_template.txt > build/peach.service + sed -f ./scripts/replace.txt ./scripts/launcher_service_template.txt > build/peach_launcher.service + sed -f ./scripts/replace.txt ./scripts/coordinator_service_template.txt > build/peach_coordinator.service rm ./scripts/replace.txt + + printf "done\n" printf "Collecting dependencies..." @@ -85,10 +92,10 @@ waittillstopped() { } buildcoordinator() { - printf "Building client coordinator" + printf "Building coordinator" #check hash - hash "peach_client_coordinator" + hash "peach_coordinator" h=$? if [[ "$h" == "1" ]]; then printf "\nSkipping. No changes were made.\n" @@ -96,9 +103,9 @@ buildcoordinator() { fi printf "\nCompiling..." - go build -o build/coordinator-$version.exe ./src/peach_client_coordinator || fail - printf "\nDone building client coordinator\n" - storehash "peach_client_coordinator" + go build -o build/coordinator-$version.exe ./src/peach_coordinator || fail + printf "\nDone building coordinator\n" + storehash "peach_coordinator" } builddiscordclient() { diff --git a/scripts/coordinator_service_template.txt b/scripts/coordinator_service_template.txt new file mode 100644 index 0000000..044f32f --- /dev/null +++ b/scripts/coordinator_service_template.txt @@ -0,0 +1,13 @@ +[Unit] +Description=Peach Discord Bot +After=network.target + +[Service] +Type=simple +User=peach +ExecStart=/home/peach/coordinator-${version}.exe +Restart=always +WorkingDirectory=/home/peach + +[Install] +WantedBy=default.target \ No newline at end of file diff --git a/scripts/service_template.txt b/scripts/launcher_service_template.txt similarity index 78% rename from scripts/service_template.txt rename to scripts/launcher_service_template.txt index 5a51b69..21021db 100644 --- a/scripts/service_template.txt +++ b/scripts/launcher_service_template.txt @@ -5,7 +5,7 @@ After=network.target [Service] Type=simple User=peach -ExecStart=/home/peach/${version}-launcher.exe +ExecStart=/home/peach/launcher-${version}.exe Restart=always WorkingDirectory=/home/peach diff --git a/scripts/test.sh b/scripts/test.sh index 3738eb7..7a6d17b 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,3 +1,3 @@ go test -v ./src/peach_discord_client -go test -v ./src/peach_client_coordinator +go test -v ./src/peach_coordinator go test -v ./src/peach_launcher \ No newline at end of file diff --git a/src/peach_client_coordinator/database.go b/src/peach_coordinator/database.go similarity index 100% rename from src/peach_client_coordinator/database.go rename to src/peach_coordinator/database.go diff --git a/src/peach_client_coordinator/database_structs.go b/src/peach_coordinator/database_structs.go similarity index 100% rename from src/peach_client_coordinator/database_structs.go rename to src/peach_coordinator/database_structs.go diff --git a/src/peach_client_coordinator/main.go b/src/peach_coordinator/main.go similarity index 91% rename from src/peach_client_coordinator/main.go rename to src/peach_coordinator/main.go index 2a12577..601d080 100644 --- a/src/peach_client_coordinator/main.go +++ b/src/peach_coordinator/main.go @@ -4,7 +4,6 @@ import ( "flag" "net/http" "os" - "runtime" "github.com/gorilla/mux" @@ -24,9 +23,6 @@ func createlog() *logrus.Logger { DisableTimestamp: false, FullTimestamp: true, TimestampFormat: "2006-01-02 15:04:05", - CallerPrettyfier: func(f *runtime.Frame) (string, string) { - return " CCoord", "" - }, }) l.SetOutput(os.Stdout) l.SetLevel(logrus.DebugLevel) @@ -40,7 +36,7 @@ func main() { secret := flag.String("secret", "", "secret") dbc := flag.String("dbc", "", "data base credentials string") - port := flag.String("port", "5000", "port the client coordinator should run on") + port := flag.String("port", "5000", "port the coordinator should run on") certType := flag.String("certtype", "none", "build if cert is located in build folder, letsencrypt if cert is located under /etc/letsencrypt/live/") domain := flag.String("domain", "none", "domain") flag.Parse() diff --git a/src/peach_client_coordinator/paths.go b/src/peach_coordinator/paths.go similarity index 100% rename from src/peach_client_coordinator/paths.go rename to src/peach_coordinator/paths.go diff --git a/src/peach_client_coordinator/queries.go b/src/peach_coordinator/queries.go similarity index 100% rename from src/peach_client_coordinator/queries.go rename to src/peach_coordinator/queries.go diff --git a/src/peach_client_coordinator/shard_managing.go b/src/peach_coordinator/shard_managing.go similarity index 100% rename from src/peach_client_coordinator/shard_managing.go rename to src/peach_coordinator/shard_managing.go diff --git a/src/peach_client_coordinator/structs.go b/src/peach_coordinator/structs.go similarity index 100% rename from src/peach_client_coordinator/structs.go rename to src/peach_coordinator/structs.go diff --git a/src/peach_client_coordinator/tokens.go b/src/peach_coordinator/tokens.go similarity index 100% rename from src/peach_client_coordinator/tokens.go rename to src/peach_coordinator/tokens.go diff --git a/src/peach_discord_client/client.go b/src/peach_discord_client/client.go index 4b8d889..b2e2603 100644 --- a/src/peach_discord_client/client.go +++ b/src/peach_discord_client/client.go @@ -1,11 +1,7 @@ package main import ( - "encoding/json" - "errors" - "fmt" "net/http" - "strconv" "sync" "time" @@ -39,8 +35,8 @@ type Client struct { // Gateway URL GatewayURL string - // Client Coordinator - ClientCoordinatorURL string + // Coordinator + CoordinatorURL string // Connected represents the clients connection status Connected chan interface{} @@ -55,10 +51,10 @@ type Client struct { User *User // Heartbeat - HeartbeatInterval time.Duration // Interval in which client should sent heartbeats - LastHeartbeatAck time.Time // Last time the client received a heartbeat acknowledgement - MissingHeartbeatAcks time.Duration // Number of Acks that can be missed before reconnecting - CCHeartbeatInterval string + HeartbeatInterval time.Duration // Interval in which client should sent heartbeats + LastHeartbeatAck time.Time // Last time the client received a heartbeat acknowledgement + MissingHeartbeatAcks time.Duration // Number of Acks that can be missed before reconnecting + CoordinatorHeartbeatInterval string // Websocket Connection wsConn *websocket.Conn @@ -95,120 +91,21 @@ func (c *Client) Run() error { return nil } -// CCLogin registeres the client in the client coordinator and reserves a shard -func CCLogin(c *Client) error { - - tempClient := &http.Client{} - req, err := http.NewRequest("GET", c.ClientCoordinatorURL+"login", nil) - if err != nil && err == errors.New("EOF") { - time.Sleep(time.Second * 5) - return CCLogin(c) - } else if err != nil { - return err - } - req.Header.Add("authorization", c.CLUSTERSECRET) - resp, err := tempClient.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - - if resp.StatusCode == http.StatusNoContent { - return errors.New("Requesting ShardID failed - all shards assigned") - } else if resp.StatusCode != http.StatusOK { - return errors.New(fmt.Sprintf("ClientCoordinator sent unexpected response: Want 200Ok Got %s", resp.Status)) - } - - ClientCoordinator := ClientCoordinatorResponse{} - err = json.NewDecoder(resp.Body).Decode(&ClientCoordinator) - if err != nil { - return err - } - c.ShardCount = ClientCoordinator.TotalShards - c.ShardID = ClientCoordinator.ShardID - c.GatewayURL = ClientCoordinator.GatewayURL - c.CCHeartbeatInterval = ClientCoordinator.HeartbeatInterval - c.TOKEN = ClientCoordinator.Token - - if redactSensitive { - ClientCoordinator.Token = "[REDACTED]" - } - - c.Log.Debugf("Websocket: Received from client coordinator: %v", ClientCoordinator) - return nil -} - -func setCCRequestHeaders(c *Client, req *http.Request) *http.Request { - req.Header.Add("authorization", c.CLUSTERSECRET) - req.Header.Add("bot_id", c.User.ID) - req.Header.Add("shard_id", strconv.Itoa(c.ShardID)) - req.Close = true - return req -} - -// CCReady asdasd -func CCReady(c *Client) error { - tempClient := &http.Client{} - req, err := http.NewRequest("GET", c.ClientCoordinatorURL+"ready", nil) - if err != nil { - return err - } - req = setCCRequestHeaders(c, req) - resp, err := tempClient.Do(req) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - c.Log.Fatalf("Websocket received unexpected response from client coordinator. Expected Status 200 OK got %s instead", resp.Status) - } - return nil -} - -// CCHeartbeat stfu -func (c *Client) CCHeartbeat() { - c.Log.Info("Started sending heartbeat to client coordinator.") - interval, err := time.ParseDuration(c.CCHeartbeatInterval) - if err != nil { - c.Log.Fatal(err) - } - ticker := time.NewTicker(interval) - for { - tempClient := &http.Client{} - req, err := http.NewRequest("GET", c.ClientCoordinatorURL+"heartbeat", nil) - if err != nil { - c.Log.Error(err) - } - req = setCCRequestHeaders(c, req) - resp, err := tempClient.Do(req) - if err != nil { - c.Log.Error(err) - } - defer resp.Body.Close() - if resp.StatusCode != http.StatusOK { - c.Log.Errorf("Websocket received unexpected response from client coordinator. Expected Status 200 OK got %s instead", resp.Status) - } - select { - case <-ticker.C: - } - } -} - // CreateClient creates a new discord client -func CreateClient(log *logrus.Logger, sharded bool, ccURL string, secret string) (c *Client, err error) { +func CreateClient(log *logrus.Logger, sharded bool, coordiantorURL string, secret string) (c *Client, err error) { c = &Client{Sequence: new(int64), Log: log} c.Starttime = time.Now() c.Settings = make(map[string]cfgSettings) c.Ratelimiter = CreateRatelimiter() - // Parse client coordinator for gateway url and shardID + // login to coordinator if sharded { - c.ClientCoordinatorURL = ccURL + c.CoordinatorURL = coordiantorURL c.CLUSTERSECRET = secret - err = CCLogin(c) + err = c.CoordinatorLogin() if err != nil { return nil, err } diff --git a/src/peach_discord_client/coordinator.go b/src/peach_discord_client/coordinator.go new file mode 100644 index 0000000..e806b59 --- /dev/null +++ b/src/peach_discord_client/coordinator.go @@ -0,0 +1,109 @@ +package main + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "strconv" + "time" +) + +// CoordinatorLogin registeres the client in the coordinator and reserves a shard +func (c *Client) CoordinatorLogin() error { + + tempClient := &http.Client{} + req, err := http.NewRequest("GET", c.CoordinatorURL+"login", nil) + if err != nil && err == errors.New("EOF") { + time.Sleep(time.Second * 5) + return c.CoordinatorLogin() + } else if err != nil { + return err + } + req.Header.Add("authorization", c.CLUSTERSECRET) + resp, err := tempClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusNoContent { + return errors.New("Requesting ShardID failed - all shards assigned") + } else if resp.StatusCode != http.StatusOK { + return errors.New(fmt.Sprintf("ClientCoordinator sent unexpected response: Want 200Ok Got %s", resp.Status)) + } + + coordresp := CoordinatorResponse{} + err = json.NewDecoder(resp.Body).Decode(&coordresp) + if err != nil { + return err + } + c.ShardCount = coordresp.TotalShards + c.ShardID = coordresp.ShardID + c.GatewayURL = coordresp.GatewayURL + c.CoordinatorHeartbeatInterval = coordresp.HeartbeatInterval + c.TOKEN = coordresp.Token + + if redactSensitive { + coordresp.Token = "[REDACTED]" + } + + c.Log.Debugf("Websocket: Received from coordinator: %v", coordresp) + return nil +} + +func (c *Client) setCoordinatorRequestHeaders(req *http.Request) *http.Request { + req.Header.Add("authorization", c.CLUSTERSECRET) + req.Header.Add("bot_id", c.User.ID) + req.Header.Add("shard_id", strconv.Itoa(c.ShardID)) + req.Close = true + return req +} + +// CCReady asdasd +func (c *Client) CoordiantorReady() error { + tempClient := &http.Client{} + req, err := http.NewRequest("GET", c.CoordinatorURL+"ready", nil) + if err != nil { + return err + } + req = c.setCoordinatorRequestHeaders(req) + resp, err := tempClient.Do(req) + if err != nil { + return err + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + c.Log.Fatalf("Websocket received unexpected response from coordinator. Expected Status 200 OK got %s instead", resp.Status) + } + return nil +} + +// CCHeartbeat stfu +func (c *Client) CoordinatorHeartbeat() { + c.Log.Info("Started sending heartbeat to coordinator.") + interval, err := time.ParseDuration(c.CoordinatorHeartbeatInterval) + if err != nil { + c.Log.Fatal(err) + } + ticker := time.NewTicker(interval) + for { + tempClient := &http.Client{} + req, err := http.NewRequest("GET", c.CoordinatorURL+"heartbeat", nil) + if err != nil { + c.Log.Error(err) + } + req = c.setCoordinatorRequestHeaders(req) + resp, err := tempClient.Do(req) + if err != nil { + c.Log.Error(err) + } + defer resp.Body.Close() + if resp.StatusCode != http.StatusOK { + c.Log.Errorf("Websocket received unexpected response from coordinator. Expected Status 200 OK got %s instead", resp.Status) + } + select { + case <-ticker.C: + } + } +} diff --git a/src/peach_discord_client/eventhandlers.go b/src/peach_discord_client/eventhandlers.go index 7713a78..a8d2f01 100644 --- a/src/peach_discord_client/eventhandlers.go +++ b/src/peach_discord_client/eventhandlers.go @@ -201,15 +201,15 @@ func (c *Client) onReady(ctx *EventReady) error { //Store session ID c.SessionID = ctx.SessionID - //If sharded start heartbeat and tell client coordinator that client is running + //If sharded start heartbeat and tell coordinator that client is running if c.Sharded { - err := CCReady(c) + err := c.CoordinatorLogin() if err != nil { return err } - go c.CCHeartbeat() + go c.CoordinatorHeartbeat() } err := c.FetchAll() diff --git a/src/peach_discord_client/main.go b/src/peach_discord_client/main.go index 74bc87a..5961a38 100644 --- a/src/peach_discord_client/main.go +++ b/src/peach_discord_client/main.go @@ -43,8 +43,8 @@ func main() { sharded := flag.Bool("sharded", false, "determines weather bot runs in shards or not") TOKEN := flag.String("token", "", "token override instead of secrets") loglevel := flag.String("log", "info", "declares how verbose the logging should be ('debug', 'info', 'error')") - ccURL := flag.String("ccurl", "", "url of the client coordinator") - secret := flag.String("secret", "", "secret for communicating with the client coordinator") + ccURL := flag.String("ccurl", "", "url of the coordinator") + secret := flag.String("secret", "", "secret for communicating with the coordinator") spotifyid := flag.String("spotifyid", "", "Spotify client id for spotify extension") spotifysecret := flag.String("spotifysecret", "", "Spotify client secret for spotify extension") redactSensitiveFlag := flag.Bool("redactsensitive", true, "Set to true to sensitive tokens and secrets from logs") diff --git a/src/peach_discord_client/settings.go b/src/peach_discord_client/settings.go index bbaf2b4..d542126 100644 --- a/src/peach_discord_client/settings.go +++ b/src/peach_discord_client/settings.go @@ -37,11 +37,11 @@ func (c *Client) getGuildSettings(guildID string) error { guildID = fmt.Sprintf(guildID, "") } - req, err := http.NewRequest("GET", c.ClientCoordinatorURL+"guilds/"+guildID, nil) + req, err := http.NewRequest("GET", c.CoordinatorURL+"guilds/"+guildID, nil) if err != nil { return err } - req = setCCRequestHeaders(c, req) + req = c.setCoordinatorRequestHeaders(req) r := http.Response{} resp := &r @@ -58,7 +58,7 @@ func (c *Client) getGuildSettings(guildID string) error { defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - return fmt.Errorf("Websocket received unexpected response from client coordinator. Expected Status 200 OK got %s instead", resp.Status) + return fmt.Errorf("Websocket received unexpected response from coordinator. Expected Status 200 OK got %s instead", resp.Status) } settings := cfgSettings{} diff --git a/src/peach_discord_client/structs.go b/src/peach_discord_client/structs.go index d0528a5..a1decac 100644 --- a/src/peach_discord_client/structs.go +++ b/src/peach_discord_client/structs.go @@ -66,8 +66,8 @@ type HeartbeatPayload struct { Data int64 `json:"d"` } -// ClientCoordinatorResponse is used to unmarshal the client coordinator response -type ClientCoordinatorResponse struct { +// CoordinatorResponse is used to unmarshal the coordinator response +type CoordinatorResponse struct { Token string `json:"token"` TotalShards int `json:"total_shards"` ShardID int `json:"assigned_shard"` From f87f643dec3e8862f191b049ffb39b062e0fa311 Mon Sep 17 00:00:00 2001 From: jul Date: Sat, 1 May 2021 17:36:13 +0200 Subject: [PATCH 08/13] Docs: Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5d0686d..5b860b3 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A Discord server management and chat bot with loads of handy features

GitHub version Build Status + Go Report License Contributors Open Issues

From 521c7ee90f5746ca48c4a492f1a56a4dd8b1555e Mon Sep 17 00:00:00 2001 From: jul Date: Sat, 1 May 2021 17:41:13 +0200 Subject: [PATCH 09/13] Quality: Corrected misspells --- src/peach_discord_client/coordinator.go | 2 +- src/peach_discord_client/websocket.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/peach_discord_client/coordinator.go b/src/peach_discord_client/coordinator.go index e806b59..500b243 100644 --- a/src/peach_discord_client/coordinator.go +++ b/src/peach_discord_client/coordinator.go @@ -9,7 +9,7 @@ import ( "time" ) -// CoordinatorLogin registeres the client in the coordinator and reserves a shard +// CoordinatorLogin registers the client in the coordinator and reserves a shard func (c *Client) CoordinatorLogin() error { tempClient := &http.Client{} diff --git a/src/peach_discord_client/websocket.go b/src/peach_discord_client/websocket.go index 2078b7d..cf9c93b 100644 --- a/src/peach_discord_client/websocket.go +++ b/src/peach_discord_client/websocket.go @@ -213,13 +213,13 @@ func (c *Client) Heartbeat() { // Hello handles the initial Hello event func (c *Client) Hello() error { - // Retreive Hello message + // Retrieve Hello message messageType, message, err := c.wsConn.ReadMessage() if err != nil { return err } - // Retreive event out of message + // Retrieve event out of message event, err := c.DecodeMessage(messageType, message, false) if err != nil { return err From 692a76f2b56f56be26fcfaab458b421d59520c0c Mon Sep 17 00:00:00 2001 From: jul Date: Sat, 1 May 2021 17:46:12 +0200 Subject: [PATCH 10/13] Build: Make version.sh executable --- scripts/version.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 scripts/version.sh diff --git a/scripts/version.sh b/scripts/version.sh old mode 100644 new mode 100755 From a0af864354a1711abb48f3161e2dd084dc58b059 Mon Sep 17 00:00:00 2001 From: jul Date: Sat, 1 May 2021 17:50:50 +0200 Subject: [PATCH 11/13] Client: Added missing error return --- src/peach_discord_client/http.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/peach_discord_client/http.go b/src/peach_discord_client/http.go index eabec8e..b55ea34 100644 --- a/src/peach_discord_client/http.go +++ b/src/peach_discord_client/http.go @@ -44,6 +44,9 @@ func (c *Client) request(method string, endpointURL string, routeid string, body defer resp.Body.Close() err = route.Release(resp.Header) + if err != nil { + return nil, nil, err + } respbody, err := ioutil.ReadAll(resp.Body) if err != nil { From 72a14400790f0b990b6fb04a3d6b8d280f71b093 Mon Sep 17 00:00:00 2001 From: jul Date: Sun, 2 May 2021 17:31:05 +0200 Subject: [PATCH 12/13] Coordinator: Added launcher login --- launchcfg.json.template | 12 ++- scripts/run.sh | 2 +- src/peach_coordinator/config.go | 42 ++++++++++ src/peach_coordinator/database.go | 39 ++++----- src/peach_coordinator/main.go | 32 +++----- src/peach_coordinator/paths.go | 99 ++++++++++++++++------- src/peach_coordinator/queries.go | 5 +- src/peach_coordinator/shard_managing.go | 11 +-- src/peach_coordinator/structs.go | 15 +++- src/peach_coordinator/tokens.go | 4 +- src/peach_discord_client/client.go | 6 +- src/peach_discord_client/coordinator.go | 25 +++--- src/peach_discord_client/eventhandlers.go | 2 +- src/peach_discord_client/main.go | 4 +- src/peach_discord_client/structs.go | 2 + src/peach_launcher/config.go | 42 ++++++++++ src/peach_launcher/launcher.go | 83 ++----------------- src/peach_launcher/main.go | 17 ++-- 18 files changed, 245 insertions(+), 197 deletions(-) create mode 100644 src/peach_coordinator/config.go create mode 100644 src/peach_launcher/config.go diff --git a/launchcfg.json.template b/launchcfg.json.template index f2bbc7a..55ab2f1 100644 --- a/launchcfg.json.template +++ b/launchcfg.json.template @@ -1,17 +1,15 @@ { - "clients": { - "sharded": true, - "shards": 2, - "token": "", + "launcher": { + "max_clients": 5, "log_level": "info", - "coordinator": "http://localhost:8080/api/", - "spotify_client_id": "2ih14ihojk21hjko312kjh", - "spotify_client_secret": "3iuhj4i2huuih4oj32uhio423" + "coordinator": "http://localhost:8080/api/" }, "clientcoordinator": { "launch": true, "port": "5000", "dbc": "database, user, password, host, port", + "spotify_client_id": "2ih14ihojk21hjko312kjh", + "spotify_client_secret": "3iuhj4i2huuih4oj32uhio423", "cert_type": "letsencrypt", "domain": "example.domain" }, diff --git a/scripts/run.sh b/scripts/run.sh index ee8331d..e6cd0e5 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -11,4 +11,4 @@ echo "Running launcher" version=$(./scripts/version.sh) cd build -./launcher-$version.exe \ No newline at end of file +./launcher-$version.exe & ./coordinator-$version.exe && fg \ No newline at end of file diff --git a/src/peach_coordinator/config.go b/src/peach_coordinator/config.go new file mode 100644 index 0000000..f980baa --- /dev/null +++ b/src/peach_coordinator/config.go @@ -0,0 +1,42 @@ +package main + +import ( + "encoding/json" + "io/ioutil" + "os" +) + +type Config struct { + Launcher struct { + MaxClients int `json:"max_clients"` + LogLevel string `json:"log_level"` + CoordinatorURL string `json:"coordinator"` + } `json:"launcher,omitempty"` + Coordinator struct { + Launch bool `json:"launch"` + Port string `json:"port"` + DBCredentials string `json:"dbc"` + SpotifyClientID string `json:"spotify_client_id"` + SpotifyClientSecret string `json:"spotify_client_secret"` + CertType string `json:"cert_type"` + Domain string `json:"domain"` + } `json:"coordinator,omitempty"` + Secret string `json:"secret"` + RedactSensitive bool `json:"redact_sensitive"` +} + +func (c *Coordinator) loadJson() error { + f, err := os.Open("launchcfg.json") + if err != nil { + return err + } + defer f.Close() + + b, err := ioutil.ReadAll(f) + if err != nil { + return err + } + json.Unmarshal(b, &c.Config) + + return nil +} diff --git a/src/peach_coordinator/database.go b/src/peach_coordinator/database.go index 8e16d8f..b2b04de 100644 --- a/src/peach_coordinator/database.go +++ b/src/peach_coordinator/database.go @@ -2,34 +2,34 @@ package main import ( "context" + "log" "strings" "time" "github.com/jackc/pgx/v4" "github.com/pkg/errors" - "github.com/sirupsen/logrus" ) -type database struct { - log *logrus.Logger - dbconn *pgx.Conn +type Database struct { + C *Coordinator + DBConn *pgx.Conn } -func refreshconn(dbcstring string) { +func (c *Coordinator) refreshDBConn(dbcstring string) { for { - if db.dbconn.IsClosed() { - createdb(db.log, dbcstring) + if c.DB.DBConn.IsClosed() { + c.createdb(dbcstring) break } time.Sleep(5) } } -func createdb(log *logrus.Logger, dbcstring string) { +func (c *Coordinator) createdb(dbcstring string) { // dbc := strings.Split(os.Getenv("DATABASE"), ", ") dbc := strings.Split(dbcstring, ", ") - db = database{log, nil} + c.DB = Database{c, nil} dsn := "" dbname := dbc[0] @@ -52,20 +52,15 @@ func createdb(log *logrus.Logger, dbcstring string) { rp := map[string]string{"application_name": "peach-discord-client"} conncfg.RuntimeParams = rp - db.dbconn, err = pgx.ConnectConfig(context.Background(), conncfg) + c.DB.DBConn, err = pgx.ConnectConfig(context.Background(), conncfg) if err != nil { log.Fatal(err) } - go refreshconn(dbcstring) - - err = db.prepare() - if err != nil { - db.log.Fatal(err) - } + go c.refreshDBConn(dbcstring) } -func (d *database) buildSettings(rows pgx.Rows) (*dbSettings, error) { +func (d *Database) buildSettings(rows pgx.Rows) (*dbSettings, error) { settings := dbSettings{Extensions: map[string]dbExtension{}} for rows.Next() { values, err := d.buildMap(rows) @@ -91,7 +86,7 @@ func (d *database) buildSettings(rows pgx.Rows) (*dbSettings, error) { return &settings, nil } -func (d *database) buildMap(row pgx.Rows) (map[string]interface{}, error) { +func (d *Database) buildMap(row pgx.Rows) (map[string]interface{}, error) { values, err := row.Values() if err != nil { return nil, errors.Errorf("couldn't retrieve row values: %s", err) @@ -108,8 +103,8 @@ func (d *database) buildMap(row pgx.Rows) (map[string]interface{}, error) { return dvm, nil } -func (d *database) getGuildSettings(guildID string) (*dbSettings, error) { - rows, err := d.dbconn.Query(context.Background(), QueryGuildSettings(guildID)) +func (d *Database) getGuildSettings(guildID string) (*dbSettings, error) { + rows, err := d.DBConn.Query(context.Background(), QueryGuildSettings(guildID)) if err != nil { return nil, err } @@ -124,8 +119,8 @@ func (d *database) getGuildSettings(guildID string) (*dbSettings, error) { return settings, nil } -func (d *database) getUserSettings(userID string) (*dbSettings, error) { - rows, err := d.dbconn.Query(context.Background(), QueryUserSettings(userID)) +func (d *Database) getUserSettings(userID string) (*dbSettings, error) { + rows, err := d.DBConn.Query(context.Background(), QueryUserSettings(userID)) if err != nil { return nil, err } diff --git a/src/peach_coordinator/main.go b/src/peach_coordinator/main.go index 601d080..7675e8b 100644 --- a/src/peach_coordinator/main.go +++ b/src/peach_coordinator/main.go @@ -1,18 +1,15 @@ package main import ( - "flag" "net/http" "os" + "runtime" "github.com/gorilla/mux" "github.com/sirupsen/logrus" ) -var clustersecret string -var db database - func createlog() *logrus.Logger { // Set log format, output and level l := logrus.New() @@ -23,6 +20,9 @@ func createlog() *logrus.Logger { DisableTimestamp: false, FullTimestamp: true, TimestampFormat: "2006-01-02 15:04:05", + CallerPrettyfier: func(f *runtime.Frame) (string, string) { + return " Coord ", "" + }, }) l.SetOutput(os.Stdout) l.SetLevel(logrus.DebugLevel) @@ -34,18 +34,10 @@ func main() { l := createlog() l.Info("shard coordinator starting...") - secret := flag.String("secret", "", "secret") - dbc := flag.String("dbc", "", "data base credentials string") - port := flag.String("port", "5000", "port the coordinator should run on") - certType := flag.String("certtype", "none", "build if cert is located in build folder, letsencrypt if cert is located under /etc/letsencrypt/live/") - domain := flag.String("domain", "none", "domain") - flag.Parse() - clustersecret = *secret - - createdb(l, *dbc) - - c := new(clientCoordinator) + c := new(Coordinator) + c.loadJson() c.log = l + c.createdb(c.Config.Coordinator.DBCredentials) c.heartbeatInterval = "10000ms" @@ -65,20 +57,20 @@ func main() { api.HandleFunc("/users/{userID}", c.pathGetUserSettings).Methods(http.MethodGet) s := &http.Server{ - Addr: ":" + *port, + Addr: ":" + c.Config.Coordinator.Port, Handler: r, } // run done := make(chan bool) - switch *certType { + switch c.Config.Coordinator.CertType { case "build": - go s.ListenAndServeTLS(*domain+".cert.pem", *domain+".key.pem") + go s.ListenAndServeTLS(c.Config.Coordinator.Domain+".cert.pem", c.Config.Coordinator.Domain+".key.pem") case "letsencrypt": - go s.ListenAndServeTLS("/etc/letsencrypt/live/"+*domain+"/fullchain.pem", "/etc/letsencrypt/live/"+*domain+"/privkey.pem") + go s.ListenAndServeTLS("/etc/letsencrypt/live/"+c.Config.Coordinator.Domain+"/fullchain.pem", "/etc/letsencrypt/live/"+c.Config.Coordinator.Domain+"/privkey.pem") case "none": - go http.ListenAndServe(":"+*port, r) + go http.ListenAndServe(":"+c.Config.Coordinator.Port, r) } // log ready diff --git a/src/peach_coordinator/paths.go b/src/peach_coordinator/paths.go index cb3e93b..63f3218 100644 --- a/src/peach_coordinator/paths.go +++ b/src/peach_coordinator/paths.go @@ -11,17 +11,17 @@ import ( "github.com/gorilla/mux" ) -func (c *clientCoordinator) verifyAuth(w http.ResponseWriter, r *http.Request) error { +func (c *Coordinator) verifyAuth(w http.ResponseWriter, r *http.Request) error { w.Header().Set("Content-Type", "application/json") authsecret := r.Header.Get("authorization") - if authsecret != clustersecret { + if authsecret != c.Config.Secret { w.WriteHeader(http.StatusUnauthorized) return errors.New(("Auth code didn't match cluster secret")) } return nil } -func (c *clientCoordinator) verifyBotShard(w http.ResponseWriter, r *http.Request) (*Bot, *Shard, error) { +func (c *Coordinator) verifyBotShard(w http.ResponseWriter, r *http.Request) (*Bot, *Shard, error) { botID := r.Header.Get("bot_id") if botID == "" { @@ -56,35 +56,67 @@ func (c *clientCoordinator) verifyBotShard(w http.ResponseWriter, r *http.Reques return bot, shard, nil } -func (c *clientCoordinator) pathLogin(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathLogin(w http.ResponseWriter, r *http.Request) { c.log.Debug("GET called api/login") + + // verify Authentication err := c.verifyAuth(w, r) if err != nil { c.log.Infof("GET 401 api/login: %s", err) return } - c.lock.Lock() - defer c.lock.Unlock() - bot, shard := c.nextShard() - if bot == nil || shard == nil { - w.WriteHeader(http.StatusNoContent) - c.log.Info("GET 204 api/ready: all shards assigned") - return - } + switch r.Header.Get("type") { + case "client": + // Allocate shard + c.lock.Lock() + defer c.lock.Unlock() + + bot, shard := c.nextShard() + if bot == nil || shard == nil { + w.WriteHeader(http.StatusNoContent) + c.log.Info("GET 204 api/login: all shards assigned") + return + } + go c.shardManager(bot, shard) + shard.Reserved = true + shard.LastHeartbeat = time.Now() + + // send response to client + response := fmt.Sprintf(`{"token": "%s", "total_shards": %d, "assigned_shard": %d, "gateway_url": "%s", "heartbeat_interval": "%s", "spotify_client_id": "%s", "spotify_client_secret": "%s"}`, bot.Token, bot.ShardCount, shard.ShardID, c.GatewayURL, c.heartbeatInterval, c.Config.Coordinator.SpotifyClientID, c.Config.Coordinator.SpotifyClientSecret) + w.Write([]byte(response)) - go c.shardManager(bot, shard) + case "launcher": - response := fmt.Sprintf(`{"token": "%s", "total_shards": %d, "assigned_shard": %d, "gateway_url": "%s", "heartbeat_interval": "%s"}`, bot.Token, bot.ShardCount, shard.ShardID, c.GatewayURL, c.heartbeatInterval) - shard.Reserved = true - shard.LastHeartbeat = time.Now() + c.lock.Lock() + defer c.lock.Unlock() + + id := r.Header.Get("id") + + l := new(Launcher) + l.ActiveClients = 0 + l.ID = id + maxc := r.Header.Get("max_clients") + maxClients, err := strconv.Atoi(maxc) + if err != nil { + w.WriteHeader(http.StatusForbidden) + w.Write([]byte("Invalid max_clients")) + } + l.MaxClients = maxClients + c.Launchers[id] = l + + // send response to launcher + response := fmt.Sprintf(`{"heartbeat_interval": "%s"}`, c.heartbeatInterval) + w.Write([]byte(response)) + + } w.WriteHeader(http.StatusOK) - w.Write([]byte(response)) c.log.Info("GET 200 api/login") + } -func (c *clientCoordinator) pathReady(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathReady(w http.ResponseWriter, r *http.Request) { err := c.verifyAuth(w, r) if err != nil { c.log.Info("GET 401 api/ready") @@ -108,25 +140,30 @@ func (c *clientCoordinator) pathReady(w http.ResponseWriter, r *http.Request) { c.log.Info("GET 200 api/ready") } -func (c *clientCoordinator) pathHeartbeat(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathHeartbeat(w http.ResponseWriter, r *http.Request) { err := c.verifyAuth(w, r) if err != nil { c.log.Info("GET 401 api/heartbeat") return } - _, shard, err := c.verifyBotShard(w, r) - if err != nil { - w.Write([]byte(err.Error())) - c.log.Info("GET 404 api/heartbeat") - return + + switch r.Header.Get("type") { + case "client": + _, shard, err := c.verifyBotShard(w, r) + if err != nil { + w.Write([]byte(err.Error())) + c.log.Info("GET 404 api/heartbeat") + return + } + shard.LastHeartbeat = time.Now() + shard.MissedHeartbeats = 0 } - shard.LastHeartbeat = time.Now() - shard.MissedHeartbeats = 0 + w.WriteHeader(http.StatusOK) c.log.Info("GET 200 api/heartbeat") } -func (c *clientCoordinator) pathGetGuildSettings(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathGetGuildSettings(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) err := c.verifyAuth(w, r) if err != nil { @@ -140,7 +177,7 @@ func (c *clientCoordinator) pathGetGuildSettings(w http.ResponseWriter, r *http. return } - s, err := db.getGuildSettings(vars["guildID"]) + s, err := c.DB.getGuildSettings(vars["guildID"]) if err != nil { w.WriteHeader(http.StatusInternalServerError) c.log.Errorf("GET 500 api/guilds/%s: %s", vars["guildID"], err) @@ -157,7 +194,7 @@ func (c *clientCoordinator) pathGetGuildSettings(w http.ResponseWriter, r *http. c.log.Infof("GET 200 api/guilds/%s", vars["guildID"]) } -func (c *clientCoordinator) pathGetUserSettings(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathGetUserSettings(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) err := c.verifyAuth(w, r) if err != nil { @@ -171,7 +208,7 @@ func (c *clientCoordinator) pathGetUserSettings(w http.ResponseWriter, r *http.R return } - s, err := db.getUserSettings(vars["userID"]) + s, err := c.DB.getUserSettings(vars["userID"]) if err != nil { w.WriteHeader(http.StatusInternalServerError) c.log.Errorf("GET 500 api/users/%s: %s", vars["userID"], err) @@ -188,7 +225,7 @@ func (c *clientCoordinator) pathGetUserSettings(w http.ResponseWriter, r *http.R c.log.Infof("GET 200 api/users/%s", vars["userID"]) } -func (c *clientCoordinator) pathGetShards(w http.ResponseWriter, r *http.Request) { +func (c *Coordinator) pathGetShards(w http.ResponseWriter, r *http.Request) { err := c.verifyAuth(w, r) if err != nil { w.WriteHeader(http.StatusUnauthorized) diff --git a/src/peach_coordinator/queries.go b/src/peach_coordinator/queries.go index 2374af3..3829506 100644 --- a/src/peach_coordinator/queries.go +++ b/src/peach_coordinator/queries.go @@ -1,9 +1,5 @@ package main -func (d *database) prepare() error { - return nil -} - var ( QueryGuildSettings = func(guildID string) string { return ` @@ -77,4 +73,5 @@ var ( ORDER BY "extID", "optionPos" ` } + QueryTokens = "SELECT token FROM tokens ORDER BY priority ASC" ) diff --git a/src/peach_coordinator/shard_managing.go b/src/peach_coordinator/shard_managing.go index 088694e..c76a16a 100644 --- a/src/peach_coordinator/shard_managing.go +++ b/src/peach_coordinator/shard_managing.go @@ -10,7 +10,7 @@ import ( var errInvalidToken = errors.New("passed invalid token") -func (c *clientCoordinator) getGatewayBot(token string) (*getgatewayresponse, error) { +func (c *Coordinator) getGatewayBot(token string) (*getgatewayresponse, error) { var gwr getgatewayresponse req, err := http.NewRequest("GET", "https://discord.com/api/v8/gateway/bot", nil) if err != nil { @@ -35,7 +35,7 @@ func (c *clientCoordinator) getGatewayBot(token string) (*getgatewayresponse, er return &gwr, nil } -func (c *clientCoordinator) create() error { +func (c *Coordinator) create() error { c.httpClient = new(http.Client) c.gettokens() c.Bots = make(map[string]*Bot) @@ -58,12 +58,13 @@ func (c *clientCoordinator) create() error { bot.Shards = make(map[int]*Shard) for i := 0; i < gwr.Shards; i++ { bot.Shards[i] = &Shard{i, false, false, time.Now(), 0} + c.RequiredClients++ } } return nil } -func (c *clientCoordinator) getUser(token string) (*User, error) { +func (c *Coordinator) getUser(token string) (*User, error) { var user User req, err := http.NewRequest("GET", "https://discord.com/api/users/@me", nil) if err != nil { @@ -86,7 +87,7 @@ func (c *clientCoordinator) getUser(token string) (*User, error) { return &user, nil } -func (c *clientCoordinator) nextShard() (*Bot, *Shard) { +func (c *Coordinator) nextShard() (*Bot, *Shard) { for _, bot := range c.Bots { for _, shard := range bot.Shards { if !shard.Reserved { @@ -97,7 +98,7 @@ func (c *clientCoordinator) nextShard() (*Bot, *Shard) { return nil, nil } -func (c *clientCoordinator) shardManager(bot *Bot, shard *Shard) { +func (c *Coordinator) shardManager(bot *Bot, shard *Shard) { interval, err := time.ParseDuration(c.heartbeatInterval) if err != nil { c.log.Fatal(err) diff --git a/src/peach_coordinator/structs.go b/src/peach_coordinator/structs.go index 3e78878..3bf154c 100644 --- a/src/peach_coordinator/structs.go +++ b/src/peach_coordinator/structs.go @@ -27,13 +27,24 @@ type getgatewayresponse struct { } } -type clientCoordinator struct { +type Launcher struct { + ID string + MaxClients int + ActiveClients int +} + +type Coordinator struct { + DB Database + Config Config httpClient *http.Client log *logrus.Logger GatewayURL string - Bots map[string]*Bot `json:"bots"` + Bots map[string]*Bot `json:"bots"` + Launchers map[string]*Launcher `json:"launchers"` lock sync.Mutex heartbeatInterval string + RequiredClients int + ActiveClients int } // Bot shutup compiler diff --git a/src/peach_coordinator/tokens.go b/src/peach_coordinator/tokens.go index ba80369..80d486a 100644 --- a/src/peach_coordinator/tokens.go +++ b/src/peach_coordinator/tokens.go @@ -4,8 +4,8 @@ import "context" var tokens []string -func (c *clientCoordinator) gettokens() { - rows, err := db.dbconn.Query(context.Background(), "SELECT token FROM tokens ORDER BY priority ASC") +func (c *Coordinator) gettokens() { + rows, err := c.DB.DBConn.Query(context.Background(), QueryTokens) if err != nil { c.log.Fatal(err) } diff --git a/src/peach_discord_client/client.go b/src/peach_discord_client/client.go index b2e2603..0e476ee 100644 --- a/src/peach_discord_client/client.go +++ b/src/peach_discord_client/client.go @@ -92,7 +92,7 @@ func (c *Client) Run() error { } // CreateClient creates a new discord client -func CreateClient(log *logrus.Logger, sharded bool, coordiantorURL string, secret string) (c *Client, err error) { +func CreateClient(log *logrus.Logger, sharded bool, coordiantorURL string, secret string) (c *Client, spotifyID *string, spotifySecret *string, err error) { c = &Client{Sequence: new(int64), Log: log} c.Starttime = time.Now() @@ -105,9 +105,9 @@ func CreateClient(log *logrus.Logger, sharded bool, coordiantorURL string, secre c.CoordinatorURL = coordiantorURL c.CLUSTERSECRET = secret - err = c.CoordinatorLogin() + spotifyID, spotifySecret, err = c.CoordinatorLogin() if err != nil { - return nil, err + return nil, nil, nil, err } } diff --git a/src/peach_discord_client/coordinator.go b/src/peach_discord_client/coordinator.go index 500b243..9e9f54d 100644 --- a/src/peach_discord_client/coordinator.go +++ b/src/peach_discord_client/coordinator.go @@ -10,7 +10,8 @@ import ( ) // CoordinatorLogin registers the client in the coordinator and reserves a shard -func (c *Client) CoordinatorLogin() error { +func (c *Client) CoordinatorLogin() (*string, *string, error) { + c.Log.Debug("Attempting to register with the coordinator") tempClient := &http.Client{} req, err := http.NewRequest("GET", c.CoordinatorURL+"login", nil) @@ -18,25 +19,26 @@ func (c *Client) CoordinatorLogin() error { time.Sleep(time.Second * 5) return c.CoordinatorLogin() } else if err != nil { - return err + return nil, nil, err } req.Header.Add("authorization", c.CLUSTERSECRET) + req.Header.Add("type", "client") resp, err := tempClient.Do(req) if err != nil { - return err + return nil, nil, err } defer resp.Body.Close() if resp.StatusCode == http.StatusNoContent { - return errors.New("Requesting ShardID failed - all shards assigned") + return nil, nil, errors.New("Requesting ShardID failed - all shards assigned") } else if resp.StatusCode != http.StatusOK { - return errors.New(fmt.Sprintf("ClientCoordinator sent unexpected response: Want 200Ok Got %s", resp.Status)) + return nil, nil, errors.New(fmt.Sprintf("ClientCoordinator sent unexpected response: Want 200 Ok Got %s", resp.Status)) } coordresp := CoordinatorResponse{} err = json.NewDecoder(resp.Body).Decode(&coordresp) if err != nil { - return err + return nil, nil, err } c.ShardCount = coordresp.TotalShards c.ShardID = coordresp.ShardID @@ -49,19 +51,22 @@ func (c *Client) CoordinatorLogin() error { } c.Log.Debugf("Websocket: Received from coordinator: %v", coordresp) - return nil + return &coordresp.SpotifyID, &coordresp.SpotifySecret, nil } func (c *Client) setCoordinatorRequestHeaders(req *http.Request) *http.Request { req.Header.Add("authorization", c.CLUSTERSECRET) req.Header.Add("bot_id", c.User.ID) req.Header.Add("shard_id", strconv.Itoa(c.ShardID)) + req.Header.Add("type", "client") req.Close = true return req } -// CCReady asdasd -func (c *Client) CoordiantorReady() error { +// CCReady sends a request to the coordinator signaling that the client is up and running +func (c *Client) CoordinatorReady() error { + c.Log.Debug("Sending ready to coordinator") + tempClient := &http.Client{} req, err := http.NewRequest("GET", c.CoordinatorURL+"ready", nil) if err != nil { @@ -79,7 +84,7 @@ func (c *Client) CoordiantorReady() error { return nil } -// CCHeartbeat stfu +// CCHeartbeat periodically sends a heartbeat to the coordinator to signal that the client is still up and running func (c *Client) CoordinatorHeartbeat() { c.Log.Info("Started sending heartbeat to coordinator.") interval, err := time.ParseDuration(c.CoordinatorHeartbeatInterval) diff --git a/src/peach_discord_client/eventhandlers.go b/src/peach_discord_client/eventhandlers.go index a8d2f01..c8d5513 100644 --- a/src/peach_discord_client/eventhandlers.go +++ b/src/peach_discord_client/eventhandlers.go @@ -204,7 +204,7 @@ func (c *Client) onReady(ctx *EventReady) error { //If sharded start heartbeat and tell coordinator that client is running if c.Sharded { - err := c.CoordinatorLogin() + err := c.CoordinatorReady() if err != nil { return err } diff --git a/src/peach_discord_client/main.go b/src/peach_discord_client/main.go index 5961a38..2b49144 100644 --- a/src/peach_discord_client/main.go +++ b/src/peach_discord_client/main.go @@ -45,8 +45,6 @@ func main() { loglevel := flag.String("log", "info", "declares how verbose the logging should be ('debug', 'info', 'error')") ccURL := flag.String("ccurl", "", "url of the coordinator") secret := flag.String("secret", "", "secret for communicating with the coordinator") - spotifyid := flag.String("spotifyid", "", "Spotify client id for spotify extension") - spotifysecret := flag.String("spotifysecret", "", "Spotify client secret for spotify extension") redactSensitiveFlag := flag.Bool("redactsensitive", true, "Set to true to sensitive tokens and secrets from logs") flag.Parse() log.Infof("Sharded: %t, LogLevel: %s, coordinator URL: %s", *sharded, *loglevel, *ccURL) @@ -65,7 +63,7 @@ func main() { stop := make(chan os.Signal, 1) signal.Notify(stop, syscall.SIGTERM) - c, err := CreateClient(log, *sharded, *ccURL, *secret) + c, spotifyid, spotifysecret, err := CreateClient(log, *sharded, *ccURL, *secret) if err != nil { log.Fatal(err, "\nUnable to create new client, exiting...") } diff --git a/src/peach_discord_client/structs.go b/src/peach_discord_client/structs.go index a1decac..0954706 100644 --- a/src/peach_discord_client/structs.go +++ b/src/peach_discord_client/structs.go @@ -73,6 +73,8 @@ type CoordinatorResponse struct { ShardID int `json:"assigned_shard"` GatewayURL string `json:"gateway_url"` HeartbeatInterval string `json:"heartbeat_interval"` + SpotifyID string `json:"spotify_client_id"` + SpotifySecret string `json:"spotify_client_secret"` } // UpdateStatus is sent by the client to indicate a presence or status update. diff --git a/src/peach_launcher/config.go b/src/peach_launcher/config.go new file mode 100644 index 0000000..7787f1a --- /dev/null +++ b/src/peach_launcher/config.go @@ -0,0 +1,42 @@ +package main + +import ( + "encoding/json" + "io/ioutil" + "os" +) + +type Config struct { + Launcher struct { + MaxClients int `json:"max_clients"` + LogLevel string `json:"log_level"` + CoordinatorURL string `json:"coordinator"` + } `json:"launcher,omitempty"` + Coordinator struct { + Launch bool `json:"launch"` + Port string `json:"port"` + DBCredentials string `json:"dbc"` + SpotifyClientID string `json:"spotify_client_id"` + SpotifyClientSecret string `json:"spotify_client_secret"` + CertType string `json:"cert_type"` + Domain string `json:"domain"` + } `json:"coordinator,omitempty"` + Secret string `json:"secret"` + RedactSensitive bool `json:"redact_sensitive"` +} + +func (l *Launcher) loadJson() error { + f, err := os.Open("launchcfg.json") + if err != nil { + return err + } + defer f.Close() + + b, err := ioutil.ReadAll(f) + if err != nil { + return err + } + json.Unmarshal(b, &l.Config) + + return nil +} diff --git a/src/peach_launcher/launcher.go b/src/peach_launcher/launcher.go index b3e5751..4e270ba 100644 --- a/src/peach_launcher/launcher.go +++ b/src/peach_launcher/launcher.go @@ -1,9 +1,7 @@ package main import ( - "encoding/json" "fmt" - "io/ioutil" "os" "os/exec" "os/signal" @@ -17,6 +15,7 @@ import ( type Launcher struct { sync.Mutex + ID string Log *logrus.Logger Stop chan interface{} Config Config @@ -33,40 +32,17 @@ type Coordinator struct { Process *os.Process } -type Config struct { - Clients struct { - Sharded bool `json:"sharded"` - Shards int `json:"shards"` - Token string `json:"token"` - LogLevel string `json:"log_level"` - CoordinatorURL string `json:"coordinator"` - SpotifyClientID string `json:"spotify_client_id"` - SpotifyClientSecret string `json:"spotify_client_secret"` - } `json:"clients"` - Clientcoordinator struct { - Launch bool `json:"launch"` - Port string `json:"port"` - DBCredentials string `json:"dbc"` - CertType string `json:"cert_type"` - Domain string `json:"domain"` - } `json:"clientcoordinator"` - Secret string `json:"secret"` - RedactSensitive bool `json:"redact_sensitive"` -} - func (l *Launcher) runClient() { for { cmd := &exec.Cmd{ Path: "./discordclient-" + VERSION + ".exe", Args: []string{ "./discordclient-" + VERSION + ".exe", - fmt.Sprintf("--log=%s", l.Config.Clients.LogLevel), - fmt.Sprintf("--sharded=%t", l.Config.Clients.Sharded), - fmt.Sprintf("--token=%s", l.Config.Clients.Token), - fmt.Sprintf("--ccurl=%s", shellescape.Quote(l.Config.Clients.CoordinatorURL)), + fmt.Sprintf("--log=%s", l.Config.Launcher.LogLevel), + fmt.Sprintf("--sharded=%t", true), + fmt.Sprintf("--token=%s", ""), + fmt.Sprintf("--ccurl=%s", shellescape.Quote(l.Config.Launcher.CoordinatorURL)), fmt.Sprintf("--secret=%s", l.Config.Secret), - fmt.Sprintf("--spotifyid=%s", l.Config.Clients.SpotifyClientID), - fmt.Sprintf("--spotifysecret=%s", l.Config.Clients.SpotifyClientSecret), fmt.Sprintf("--redactsensitive=%t", l.Config.RedactSensitive), }, Stdout: os.Stdout, @@ -91,65 +67,16 @@ func (l *Launcher) runClient() { } } -func (l *Launcher) runCoordinator() { - cmd := &exec.Cmd{ - Path: "./coordinator-" + VERSION + ".exe", - Args: []string{ - "./coordinator-" + VERSION + ".exe", - fmt.Sprintf("--secret=%s", l.Config.Secret), - fmt.Sprintf("--dbc=%s", l.Config.Clientcoordinator.DBCredentials), - fmt.Sprintf("--port=%s", l.Config.Clientcoordinator.Port), - fmt.Sprintf("--certtype=%s", l.Config.Clientcoordinator.CertType), - fmt.Sprintf("--domain=%s", l.Config.Clientcoordinator.Domain), - }, - Stdout: os.Stdout, - Stderr: os.Stderr, - } - var c Coordinator - c.Process = cmd.Process - l.Coordinator = c - err := cmd.Run() - if err != nil { - l.Log.Fatal(err) - } -} - func (c *Client) stop() { c.Process.Signal(syscall.SIGTERM) } -func (c *Coordinator) stop() { - c.Process.Signal(syscall.SIGTERM) -} - -func (l *Launcher) loadJson() error { - f, err := os.Open("launchcfg.json") - if err != nil { - return err - } - defer f.Close() - - b, err := ioutil.ReadAll(f) - if err != nil { - return err - } - json.Unmarshal(b, &l.Config) - - return nil -} - func (l *Launcher) SetupCloseHandler() { c := make(chan os.Signal) signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c fmt.Println("\r- Ctrl+C pressed in Terminal") - - // for _, c := range l.Clients { - // c.stop() - // } - // l.Coordinator.stop() - os.Exit(0) }() } diff --git a/src/peach_launcher/main.go b/src/peach_launcher/main.go index 53a8c7c..4ff8b66 100644 --- a/src/peach_launcher/main.go +++ b/src/peach_launcher/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "math/rand" "os" "runtime" "time" @@ -34,8 +36,11 @@ func createLog() *logrus.Logger { } func main() { + r := rand.New(rand.NewSource(time.Now().UnixNano())) + var l Launcher l.Log = createLog() + l.ID = fmt.Sprint(r.Int()) err := l.loadJson() if err != nil { @@ -49,14 +54,10 @@ func main() { go keepAlive() - if l.Config.Clientcoordinator.Launch { - go l.runCoordinator() - } - - for i := 0; i < l.Config.Clients.Shards; i++ { - time.Sleep(5 * time.Second) - go l.runClient() - } + // for i := 0; i < l.Config.Clients.Shards; i++ { + go l.runClient() + time.Sleep(1 * time.Second) + // } select { case <-l.Stop: From 80c50415e8270c902a6337e012b76d4b40269fac Mon Sep 17 00:00:00 2001 From: jul Date: Mon, 21 Jun 2021 13:30:15 +0200 Subject: [PATCH 13/13] Spotify: Fixed icon --- src/peach_discord_client/ext_spotify.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/peach_discord_client/ext_spotify.go b/src/peach_discord_client/ext_spotify.go index 7ae2c79..fb5be28 100644 --- a/src/peach_discord_client/ext_spotify.go +++ b/src/peach_discord_client/ext_spotify.go @@ -95,7 +95,7 @@ func (e *extSpotify) OnMessage(ctx *Message) error { Embed: Embed{ Author: EmbedAuthor{ Name: "Spotify", - IconURL: "https://assets.ifttt.com/images/channels/51464135/icons/large.png", + IconURL: "https://cdn.discordapp.com/attachments/706946272539443202/856495809344176138/spotify_green_white_transparent_64px.png", }, Thumbnail: EmbedThumbnail{URL: album.Images[0].URL}, Color: 1947988, @@ -135,7 +135,7 @@ func (e *extSpotify) OnMessage(ctx *Message) error { Embed: Embed{ Author: EmbedAuthor{ Name: "Spotify", - IconURL: "https://assets.ifttt.com/images/channels/51464135/icons/large.png", + IconURL: "https://cdn.discordapp.com/attachments/706946272539443202/856495809344176138/spotify_green_white_transparent_64px.png", }, Thumbnail: EmbedThumbnail{URL: track.Album.Images[0].URL}, Color: 1947988, @@ -190,7 +190,7 @@ func (e *extSpotify) OnMessage(ctx *Message) error { Embed: Embed{ Author: EmbedAuthor{ Name: "Spotify", - IconURL: "https://assets.ifttt.com/images/channels/51464135/icons/large.png", + IconURL: "https://cdn.discordapp.com/attachments/706946272539443202/856495809344176138/spotify_green_white_transparent_64px.png", }, Thumbnail: EmbedThumbnail{URL: artist.Images[0].URL}, Color: 1947988,