diff --git a/.github/workflows/ci-test-backend.yml b/.github/workflows/ci-test-backend.yml index 0e2350ff..8a022b1f 100644 --- a/.github/workflows/ci-test-backend.yml +++ b/.github/workflows/ci-test-backend.yml @@ -34,7 +34,7 @@ jobs: - name: install golangci-lint and goveralls run: | - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.43.0 + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.44.0 go get -u github.com/mattn/goveralls - name: test and lint backend diff --git a/backend/_example/memory_store/go.mod b/backend/_example/memory_store/go.mod index dbe2cdeb..9dedcbd2 100644 --- a/backend/_example/memory_store/go.mod +++ b/backend/_example/memory_store/go.mod @@ -5,10 +5,10 @@ go 1.16 require ( github.com/go-pkgz/jrpc v0.2.0 github.com/go-pkgz/lgr v0.10.4 + github.com/jessevdk/go-flags v1.5.0 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.7.0 - github.com/umputun/go-flags v1.5.1 - github.com/umputun/remark42/backend v1.8.1 + github.com/umputun/remark42/backend v1.9.0 ) replace github.com/umputun/remark42/backend => ../../ diff --git a/backend/_example/memory_store/go.sum b/backend/_example/memory_store/go.sum index b054d2fc..12c9b481 100644 --- a/backend/_example/memory_store/go.sum +++ b/backend/_example/memory_store/go.sum @@ -25,12 +25,16 @@ cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aD cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= 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/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.1.0/go.mod h1:2NIffxgWfORSI7EOYMFatGTfjMLnqrOKBEyYb6NoRgA= 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= @@ -53,8 +57,8 @@ github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejn github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= -github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44= -github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= +github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= +github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= @@ -80,7 +84,7 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4Tk1ujxk= +github.com/dghubble/oauth1 v0.7.1/go.mod h1:0eEzON0UY/OLACQrmnjgJjmvCGXzjBCsZqL1kWDXtF0= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/didip/tollbooth/v6 v6.0.1/go.mod h1:j2pKs+JQ5PvU/K4jFnrnwntrmfUbYLJE5oSdxR37FD0= github.com/didip/tollbooth/v6 v6.1.1 h1:Nt7PvWLa9Y94OrykXsFNBinVRQIu8xdy4avpl99Dc1M= @@ -106,14 +110,14 @@ github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4= github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= -github.com/go-chi/chi/v5 v5.0.5/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8= github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1OvJns= 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-pkgz/auth v1.18.1-0.20211207184750-78e5d290333d/go.mod h1:N1VM53c22Uw0UQSYgdTOBK1D2vtPjSc/RWGf/Fhc1y8= +github.com/go-pkgz/auth v1.18.1-0.20220131194604-2eb160b3c90c/go.mod h1:QDsgzQg6aYlN9jxd8Hk8Q8nUjPR2L0hp0rcavlGMwrw= github.com/go-pkgz/expirable-cache v0.0.3 h1:rTh6qNPp78z0bQE6HDhXBHUwqnV9i09Vm6dksJLXQDc= github.com/go-pkgz/expirable-cache v0.0.3/go.mod h1:+IauqN00R2FqNRLCLA+X5YljQJrwB179PfiAoMPlTlQ= github.com/go-pkgz/jrpc v0.2.0 h1:CLy/eZyekjraVrxZV18N2R1mYLMJ/nWrgdfyIOGPY/E= @@ -123,38 +127,15 @@ github.com/go-pkgz/lgr v0.10.4 h1:l7qyFjqEZgwRgaQQSEp6tve4A3OU80VrfzpvtEX8ngw= github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPqeCF0= github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw= github.com/go-pkgz/rest v1.5.0/go.mod h1:nQaM3RhSTUAmbBZWY4hfe4buyeC9VckvhoCktiQXJxI= -github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E= -github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= -github.com/go-pkgz/syncs v1.1.1/go.mod h1:bt9lxWRRJ9vOCMGc8Big8ttjYHLKP88ofj1y38UlaHE= +github.com/go-pkgz/rest v1.12.2 h1:AQ7uuBmMcufbiUBc4IS8aqDNMvRJlhtRpXLSNRitjVo= +github.com/go-pkgz/rest v1.12.2/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk= +github.com/go-pkgz/syncs v1.2.0/go.mod h1:fjThZdM2FkC/oSeiqBTOZOtHpbrCh4HuHbipB5qZJJM= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -229,6 +210,7 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ 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/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= @@ -236,8 +218,9 @@ github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBba github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -248,34 +231,29 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= 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/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc= -github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= +github.com/microcosm-cc/bluemonday v1.0.17 h1:Z1a//hgsQ4yjC+8zEkV8IWySkXnsxmdSY642CTFQb5Y= +github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/nullrocks/identicon v0.0.0-20180626043057-7875f45b0022/go.mod h1:x4NsS+uc7ecH/Cbm9xKQ6XzmJM57rWTkjywjfB2yQ18= @@ -283,7 +261,6 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.10.1/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -293,8 +270,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -303,18 +278,13 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/slack-go/slack v0.9.5/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= +github.com/slack-go/slack v0.10.1/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -333,13 +303,12 @@ github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhV github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao= github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ= -github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY= -github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= @@ -358,7 +327,7 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.mongodb.org/mongo-driver v1.7.4/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.8.2/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= 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= @@ -368,15 +337,14 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 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= @@ -454,8 +422,9 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af h1:SMeNJG/vclJ5wyBBd4xupMsSJIHTd1coW9g7q6KOjmY= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 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= @@ -476,7 +445,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ 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-20190412183630-56d357773e84/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= @@ -485,24 +453,20 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/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-20190419153524-e8e3143a4f4a/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-20190531175056-4c3a928424d2/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-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -542,9 +506,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c h1:+8miTPjMCTXwih7BQmvWwd0PjdBZq2MKp/qQaahSzEM= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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= @@ -558,8 +527,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 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/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= @@ -567,9 +537,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 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-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/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= @@ -647,7 +614,11 @@ google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNe google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.65.0/go.mod h1:ArYhxgGadlWmqO1IqVujw6Cs8IdD33bTmzKo2Sh+cbg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 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= @@ -709,7 +680,14 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -735,6 +713,7 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -762,25 +741,16 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/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= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +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-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-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-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.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-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.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/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/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/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/backend/_example/memory_store/main.go b/backend/_example/memory_store/main.go index 180e607e..e09756f8 100644 --- a/backend/_example/memory_store/main.go +++ b/backend/_example/memory_store/main.go @@ -12,7 +12,7 @@ import ( "github.com/go-pkgz/jrpc" log "github.com/go-pkgz/lgr" - "github.com/umputun/go-flags" + "github.com/jessevdk/go-flags" "github.com/umputun/remark42/memory_store/accessor" "github.com/umputun/remark42/memory_store/server" diff --git a/backend/app/cmd/avatar_test.go b/backend/app/cmd/avatar_test.go index 503d0900..1ced05fe 100644 --- a/backend/app/cmd/avatar_test.go +++ b/backend/app/cmd/avatar_test.go @@ -6,9 +6,9 @@ import ( "testing" "github.com/go-pkgz/auth/avatar" + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/umputun/go-flags" ) func TestAvatar_Execute(t *testing.T) { diff --git a/backend/app/cmd/backup.go b/backend/app/cmd/backup.go index 76aa77ac..4cb1f784 100644 --- a/backend/app/cmd/backup.go +++ b/backend/app/cmd/backup.go @@ -62,7 +62,7 @@ func (ec *BackupCommand) Execute(_ []string) error { return responseError(resp) } - fh, err := os.Create(fname) + fh, err := os.Create(fname) //nolint:gosec // harmless if err != nil { return errors.Wrapf(err, "can't create backup file %s", fname) } diff --git a/backend/app/cmd/backup_test.go b/backend/app/cmd/backup_test.go index 755e0db5..3c32c6a7 100644 --- a/backend/app/cmd/backup_test.go +++ b/backend/app/cmd/backup_test.go @@ -7,8 +7,7 @@ import ( "os" "testing" - "github.com/umputun/go-flags" - + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/backend/app/cmd/cleanup_test.go b/backend/app/cmd/cleanup_test.go index 74552783..77e44352 100644 --- a/backend/app/cmd/cleanup_test.go +++ b/backend/app/cmd/cleanup_test.go @@ -10,9 +10,9 @@ import ( "time" "github.com/go-chi/chi/v5" + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/umputun/go-flags" "github.com/umputun/remark42/backend/app/store" ) diff --git a/backend/app/cmd/import_test.go b/backend/app/cmd/import_test.go index b92337a3..4fe5faab 100644 --- a/backend/app/cmd/import_test.go +++ b/backend/app/cmd/import_test.go @@ -9,8 +9,7 @@ import ( "time" log "github.com/go-pkgz/lgr" - "github.com/umputun/go-flags" - + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/backend/app/cmd/remap_test.go b/backend/app/cmd/remap_test.go index 0f71043f..00786f89 100644 --- a/backend/app/cmd/remap_test.go +++ b/backend/app/cmd/remap_test.go @@ -6,8 +6,7 @@ import ( "net/http/httptest" "testing" - "github.com/umputun/go-flags" - + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/backend/app/cmd/restore_test.go b/backend/app/cmd/restore_test.go index f526b902..42bb0618 100644 --- a/backend/app/cmd/restore_test.go +++ b/backend/app/cmd/restore_test.go @@ -7,8 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/umputun/go-flags" - + "github.com/jessevdk/go-flags" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/backend/app/cmd/server_test.go b/backend/app/cmd/server_test.go index d17e5314..47db9612 100644 --- a/backend/app/cmd/server_test.go +++ b/backend/app/cmd/server_test.go @@ -17,7 +17,7 @@ import ( "github.com/go-pkgz/auth/token" "github.com/golang-jwt/jwt" - "github.com/umputun/go-flags" + "github.com/jessevdk/go-flags" "go.uber.org/goleak" "github.com/stretchr/testify/assert" diff --git a/backend/app/main.go b/backend/app/main.go index 2726095d..b5a673d5 100644 --- a/backend/app/main.go +++ b/backend/app/main.go @@ -8,7 +8,7 @@ import ( "syscall" log "github.com/go-pkgz/lgr" - "github.com/umputun/go-flags" + "github.com/jessevdk/go-flags" "github.com/umputun/remark42/backend/app/cmd" ) diff --git a/backend/app/migrator/backup.go b/backend/app/migrator/backup.go index 421eff23..0c9b6b32 100644 --- a/backend/app/migrator/backup.go +++ b/backend/app/migrator/backup.go @@ -48,7 +48,7 @@ func (ab AutoBackup) Do(ctx context.Context) { func (ab AutoBackup) makeBackup() (string, error) { log.Printf("[DEBUG] make backup for %s", ab.SiteID) backupFile := fmt.Sprintf("%s/backup-%s-%s.gz", ab.BackupLocation, ab.SiteID, time.Now().Format("20060102")) - fh, err := os.Create(backupFile) + fh, err := os.Create(backupFile) //nolint:gosec // harmless if err != nil { return "", errors.Wrapf(err, "can't create backup file %s", backupFile) } diff --git a/backend/app/notify/webhook.go b/backend/app/notify/webhook.go index 8f8313f4..ff22757a 100644 --- a/backend/app/notify/webhook.go +++ b/backend/app/notify/webhook.go @@ -92,7 +92,7 @@ func (t *Webhook) Send(ctx context.Context, req Request) error { errMsg := fmt.Sprintf("webhook request failed with non-OK status code: %d", resp.StatusCode) respBody, e := io.ReadAll(resp.Body) if e != nil { - return fmt.Errorf(errMsg) + return errors.New(errMsg) } return fmt.Errorf("%s, body: %s", errMsg, respBody) } diff --git a/backend/app/rest/api/rest_public_test.go b/backend/app/rest/api/rest_public_test.go index cc445ab2..d007ba15 100644 --- a/backend/app/rest/api/rest_public_test.go +++ b/backend/app/rest/api/rest_public_test.go @@ -108,11 +108,11 @@ BKT assert.NoError(t, err) assert.Equal(t, `

h1

-
func TestRest_Preview(t *testing.T) {
-srv, ts := prep(t)
-  require.NotNil(t, srv)
-}
-
`, +
func TestRest_Preview(t *testing.T) {
+srv, ts := prep(t)
+  require.NotNil(t, srv)
+}
+
`, string(b)) assert.NoError(t, resp.Body.Close()) } @@ -134,8 +134,8 @@ BKT assert.Equal(t, http.StatusOK, resp.StatusCode) b, err := io.ReadAll(resp.Body) assert.NoError(t, err) - assert.Equal(t, `
func main(aa string) int {return 0}
-
`, string(b)) + assert.Equal(t, `
func main(aa string) int {return 0}
+
`, string(b)) assert.NoError(t, resp.Body.Close()) } diff --git a/backend/app/store/formatter_test.go b/backend/app/store/formatter_test.go index 6222b968..28394c72 100644 --- a/backend/app/store/formatter_test.go +++ b/backend/app/store/formatter_test.go @@ -32,10 +32,10 @@ func TestFormatter_FormatText(t *testing.T) { }, {"— not translated #354", "

— not translated #354

\n!converted", "mdash"}, {"smth\n```go\nfunc main(aa string) int {return 0}\n```", `

smth

-
func main(aa string) int {return 0}
-
!converted`, "code with language"}, - {"```\ntest_code\n```", `
test_code
-
!converted`, "code without language"}, +
func main(aa string) int {return 0}
+
!converted`, "code with language"}, + {"```\ntest_code\n```", `
test_code
+
!converted`, "code without language"}, } f := NewCommentFormatter(mockConverter{}) for _, tt := range tbl { diff --git a/backend/go.mod b/backend/go.mod index 7bf27b8d..bb241633 100644 --- a/backend/go.mod +++ b/backend/go.mod @@ -5,35 +5,42 @@ go 1.16 require ( github.com/Depado/bfchroma v1.3.0 github.com/PuerkitoBio/goquery v1.8.0 - github.com/alecthomas/chroma v0.9.4 + github.com/alecthomas/chroma v0.10.0 github.com/didip/tollbooth/v6 v6.1.1 github.com/didip/tollbooth_chi v0.0.0-20200828173446-a7173453ea21 - github.com/go-chi/chi/v5 v5.0.5 + github.com/go-chi/chi/v5 v5.0.7 github.com/go-chi/cors v1.2.0 github.com/go-chi/render v1.0.1 - github.com/go-pkgz/auth v1.18.1-0.20211207184750-78e5d290333d + github.com/go-pkgz/auth v1.18.1-0.20220131194604-2eb160b3c90c github.com/go-pkgz/jrpc v0.2.0 github.com/go-pkgz/lcw v0.8.1 github.com/go-pkgz/lgr v0.10.4 github.com/go-pkgz/repeater v1.1.3 - github.com/go-pkgz/rest v1.11.0 - github.com/go-pkgz/syncs v1.1.1 + github.com/go-pkgz/rest v1.12.2 + github.com/go-pkgz/syncs v1.2.0 + github.com/go-redis/redis/v7 v7.4.1 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible github.com/google/uuid v1.3.0 github.com/gorilla/feeds v1.1.1 + github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 + github.com/jessevdk/go-flags v1.5.0 github.com/kyokomi/emoji/v2 v2.2.8 - github.com/microcosm-cc/bluemonday v1.0.16 + github.com/microcosm-cc/bluemonday v1.0.17 github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 github.com/rs/xid v1.3.0 github.com/russross/blackfriday/v2 v2.1.0 - github.com/slack-go/slack v0.9.5 + github.com/slack-go/slack v0.10.1 + github.com/stretchr/objx v0.3.0 // indirect github.com/stretchr/testify v1.7.0 - github.com/umputun/go-flags v1.5.1 + github.com/tidwall/gjson v1.11.0 // indirect go.etcd.io/bbolt v1.3.6 go.uber.org/goleak v1.1.12 - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 + golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed golang.org/x/image v0.0.0-20211028202545-6944b10bf410 - golang.org/x/net v0.0.0-20211105192438-b53810dc28af + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd + golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect + gopkg.in/yaml.v2 v2.2.8 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/backend/go.sum b/backend/go.sum index d7409864..5f37457c 100644 --- a/backend/go.sum +++ b/backend/go.sum @@ -24,14 +24,19 @@ cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWc cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= 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/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.1.0 h1:pyPhehLfZ6pVzRgJmXGYvCY4K7WSWRhVw0AwhgVvS84= +cloud.google.com/go/compute v1.1.0/go.mod h1:2NIffxgWfORSI7EOYMFatGTfjMLnqrOKBEyYb6NoRgA= 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= @@ -55,8 +60,8 @@ github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= -github.com/alecthomas/chroma v0.9.4 h1:YL7sOAE3p8HS96T9km7RgvmsZIctqbK1qJ0b7hzed44= -github.com/alecthomas/chroma v0.9.4/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= +github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek= +github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= @@ -84,8 +89,8 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dghubble/oauth1 v0.7.0 h1:AlpZdbRiJM4XGHIlQ8BuJ/wlpGwFEJNnB4Mc+78tA/w= -github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4Tk1ujxk= +github.com/dghubble/oauth1 v0.7.1 h1:JjbOVSVVkms9A4h/sTQy5Jb2nFuAAVb2qVYgenJPyrE= +github.com/dghubble/oauth1 v0.7.1/go.mod h1:0eEzON0UY/OLACQrmnjgJjmvCGXzjBCsZqL1kWDXtF0= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/didip/tollbooth/v6 v6.0.1/go.mod h1:j2pKs+JQ5PvU/K4jFnrnwntrmfUbYLJE5oSdxR37FD0= @@ -114,8 +119,8 @@ github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-chi/chi v4.1.1+incompatible h1:MmTgB0R8Bt/jccxp+t6S/1VGIKdJw5J74CK/c9tTfA4= github.com/go-chi/chi v4.1.1+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= -github.com/go-chi/chi/v5 v5.0.5 h1:l3RJ8T8TAqLsXFfah+RA6N4pydMbPwSdvNM+AFWvLUM= -github.com/go-chi/chi/v5 v5.0.5/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8= +github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/cors v1.2.0 h1:tV1g1XENQ8ku4Bq3K9ub2AtgG+p16SmzeMSGTwrOKdE= github.com/go-chi/cors v1.2.0/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8= @@ -123,8 +128,8 @@ github.com/go-chi/render v1.0.1/go.mod h1:pq4Rr7HbnsdaeHagklXub+p6Wd16Af5l9koip1 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-pkgz/auth v1.18.1-0.20211207184750-78e5d290333d h1:ClnnpQqTp84SIq8NNnqDW7SpZ5b5nwdlQN3Yq7vglW8= -github.com/go-pkgz/auth v1.18.1-0.20211207184750-78e5d290333d/go.mod h1:N1VM53c22Uw0UQSYgdTOBK1D2vtPjSc/RWGf/Fhc1y8= +github.com/go-pkgz/auth v1.18.1-0.20220131194604-2eb160b3c90c h1:4e/dKZgMUwNBDAfLy749flKJO+RLBhten6uVwj40dyg= +github.com/go-pkgz/auth v1.18.1-0.20220131194604-2eb160b3c90c/go.mod h1:QDsgzQg6aYlN9jxd8Hk8Q8nUjPR2L0hp0rcavlGMwrw= github.com/go-pkgz/expirable-cache v0.0.3 h1:rTh6qNPp78z0bQE6HDhXBHUwqnV9i09Vm6dksJLXQDc= github.com/go-pkgz/expirable-cache v0.0.3/go.mod h1:+IauqN00R2FqNRLCLA+X5YljQJrwB179PfiAoMPlTlQ= github.com/go-pkgz/jrpc v0.2.0 h1:CLy/eZyekjraVrxZV18N2R1mYLMJ/nWrgdfyIOGPY/E= @@ -136,42 +141,19 @@ github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPq github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE= github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw= github.com/go-pkgz/rest v1.5.0/go.mod h1:nQaM3RhSTUAmbBZWY4hfe4buyeC9VckvhoCktiQXJxI= -github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E= -github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= -github.com/go-pkgz/syncs v1.1.1 h1:jWN+y6FS/Xe+8z4l3QMbSnODGyaxDHGojIS+wyKIjxg= -github.com/go-pkgz/syncs v1.1.1/go.mod h1:bt9lxWRRJ9vOCMGc8Big8ttjYHLKP88ofj1y38UlaHE= -github.com/go-redis/redis/v7 v7.4.0 h1:7obg6wUoj05T0EpY0o8B59S9w5yeMWql7sw2kwNW1x4= +github.com/go-pkgz/rest v1.12.2 h1:AQ7uuBmMcufbiUBc4IS8aqDNMvRJlhtRpXLSNRitjVo= +github.com/go-pkgz/rest v1.12.2/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk= +github.com/go-pkgz/syncs v1.2.0 h1:aiizQFILlMZ4KtRNaYLcDffRbUQZH9fclsgr5KybWyY= +github.com/go-pkgz/syncs v1.2.0/go.mod h1:fjThZdM2FkC/oSeiqBTOZOtHpbrCh4HuHbipB5qZJJM= github.com/go-redis/redis/v7 v7.4.0/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= +github.com/go-redis/redis/v7 v7.4.1 h1:PASvf36gyUpr2zdOUS/9Zqc80GbM+9BDyiJSJDDOrTI= +github.com/go-redis/redis/v7 v7.4.1/go.mod h1:JDNMw23GTyLNC4GZu9njt15ctBQVn7xjRfnwdHj/Dcg= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -252,6 +234,7 @@ github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ 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/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= @@ -261,8 +244,9 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -276,21 +260,18 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= +github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= 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/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw= +github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -298,14 +279,12 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqUE= github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc= -github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= +github.com/microcosm-cc/bluemonday v1.0.17 h1:Z1a//hgsQ4yjC+8zEkV8IWySkXnsxmdSY642CTFQb5Y= +github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= @@ -317,7 +296,6 @@ github.com/onsi/ginkgo v1.10.2 h1:uqH7bpe+ERSiDa34FDOF7RikN6RzXgduUF8yarlZp94= github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.7.0 h1:XPnZz8VVBHjVsy1vzJmRwIcSwiUO+JFfrv/xGiigmME= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -328,8 +306,6 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.3.0 h1:6NjYksEUlhurdVehpc7S7dk6DAmcKv8V9gG0FsVN2U4= github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= @@ -339,19 +315,14 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/slack-go/slack v0.9.5 h1:j7uOUDowybWf9eSgZg/AbGx6J1OPJB6SE8Z5dNl6Mtw= -github.com/slack-go/slack v0.9.5/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= +github.com/slack-go/slack v0.10.1 h1:BGbxa0kMsGEvLOEoZmYs8T1wWfoZXwmQFBb6FgYCXUA= +github.com/slack-go/slack v0.10.1/go.mod h1:wWL//kk0ho+FcQXcBTmEafUI5dz4qz5f4mMk8oIkioQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= +github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -378,8 +349,6 @@ github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e h1:+NL1GDIUOKxVfbp2K github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao= github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE= github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ= -github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY= -github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0 h1:uWF8lgKmeaIewWVPwi4GRq2P6+R46IgYZdxWtM+GtEY= @@ -387,8 +356,9 @@ github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBn github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.0 h1:d70R37I0HrDLsafRrMBXyrD4lmQbCHE873t00Vr0gm0= +github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= @@ -416,8 +386,8 @@ github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb h1:ZkM6LRnq40pR1Ox github.com/yuin/gopher-lua v0.0.0-20191220021717-ab39c6098bdb/go.mod h1:gqRgreBUhTSL0GeU64rtZ3Uq3wtjOa/TB2YfrtkCbVQ= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.mongodb.org/mongo-driver v1.7.4 h1:sllcioag8Mec0LYkftYWq+cKNPIR4Kqq3iv9ZXY0g/E= -go.mongodb.org/mongo-driver v1.7.4/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.8.2 h1:8ssUXufb90ujcIvR6MyE1SchaNj0SFxsakiZgxIyrMk= +go.mongodb.org/mongo-driver v1.8.2/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= 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= @@ -428,16 +398,15 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA= +golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 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= @@ -516,8 +485,9 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af h1:SMeNJG/vclJ5wyBBd4xupMsSJIHTd1coW9g7q6KOjmY= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 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= @@ -539,7 +509,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ 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-20190412183630-56d357773e84/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= @@ -549,24 +518,20 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/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-20190419153524-e8e3143a4f4a/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-20190531175056-4c3a928424d2/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-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -606,9 +571,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c h1:+8miTPjMCTXwih7BQmvWwd0PjdBZq2MKp/qQaahSzEM= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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= @@ -622,8 +592,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 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/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI= golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M= +golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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= @@ -631,9 +602,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 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-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/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= @@ -713,7 +681,11 @@ google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNe google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.65.0/go.mod h1:ArYhxgGadlWmqO1IqVujw6Cs8IdD33bTmzKo2Sh+cbg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 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= @@ -776,7 +748,14 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -802,6 +781,7 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -834,8 +814,9 @@ gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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-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= diff --git a/backend/vendor/cloud.google.com/go/LICENSE b/backend/vendor/cloud.google.com/go/compute/LICENSE similarity index 100% rename from backend/vendor/cloud.google.com/go/LICENSE rename to backend/vendor/cloud.google.com/go/compute/LICENSE diff --git a/backend/vendor/cloud.google.com/go/compute/metadata/metadata.go b/backend/vendor/cloud.google.com/go/compute/metadata/metadata.go index b6e1f7b6..5dbe77cc 100644 --- a/backend/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/backend/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -323,7 +323,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) { break } if reqErr != nil { - return "", "", nil + return "", "", reqErr } defer res.Body.Close() if res.StatusCode == http.StatusNotFound { diff --git a/backend/vendor/github.com/alecthomas/chroma/Makefile b/backend/vendor/github.com/alecthomas/chroma/Makefile index 010ec039..34e3c41c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/Makefile +++ b/backend/vendor/github.com/alecthomas/chroma/Makefile @@ -12,7 +12,7 @@ tokentype_string.go: types.go chromad: rm -f chromad - (export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .) + (export CGOENABLED=0 GOOS=linux GOARCH=amd64; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .) upload: chromad scp chromad root@swapoff.org: && \ diff --git a/backend/vendor/github.com/alecthomas/chroma/README.md b/backend/vendor/github.com/alecthomas/chroma/README.md index 7786fe1f..b62b8476 100644 --- a/backend/vendor/github.com/alecthomas/chroma/README.md +++ b/backend/vendor/github.com/alecthomas/chroma/README.md @@ -37,7 +37,7 @@ translators for Pygments lexers and styles. Prefix | Language :----: | -------- A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk -B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, BlitzBasic, BNF, Brainfuck +B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, Bicep, BlitzBasic, BNF, Brainfuck C | C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython D | D, Dart, Diff, Django/Jinja, Docker, DTD, Dylan E | EBNF, Elixir, Elm, EmacsLisp, Erlang @@ -50,7 +50,7 @@ K | Kotlin L | Lighttpd configuration file, LLVM, Lua M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL N | NASM, Newspeak, Nginx configuration file, Nim, Nix -O | Objective-C, OCaml, Octave, OnesEnterprise, OpenSCAD, Org Mode +O | Objective-C, OCaml, Octave, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python 2, Python Q | QBasic R | R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust diff --git a/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go b/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go index 5121529e..164c842d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go +++ b/backend/vendor/github.com/alecthomas/chroma/formatters/html/html.go @@ -46,6 +46,13 @@ func WithPreWrapper(wrapper PreWrapper) Option { } } +// WrapLongLines wraps long lines. +func WrapLongLines(b bool) Option { + return func(f *Formatter) { + f.wrapLongLines = b + } +} + // WithLineNumbers formats output with line numbers. func WithLineNumbers(b bool) Option { return func(f *Formatter) { @@ -131,10 +138,18 @@ var ( } defaultPreWrapper = preWrapper{ start: func(code bool, styleAttr string) string { + if code { + return fmt.Sprintf(`
`, styleAttr)
+			}
+
 			return fmt.Sprintf(`
`, styleAttr)
 		},
 		end: func(code bool) string {
-			return "
" + if code { + return `
` + } + + return `` }, } ) @@ -147,6 +162,7 @@ type Formatter struct { allClasses bool preWrapper PreWrapper tabWidth int + wrapLongLines bool lineNumbers bool lineNumbersInTable bool linkableLineNumbers bool @@ -197,10 +213,10 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. if wrapInTable { // List line numbers in its own - fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.Background)) + fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.PreWrapper)) fmt.Fprintf(w, "", f.styleAttr(css, chroma.LineTable)) fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.LineTableTD)) - fmt.Fprintf(w, f.preWrapper.Start(false, f.styleAttr(css, chroma.Background))) + fmt.Fprintf(w, f.preWrapper.Start(false, f.styleAttr(css, chroma.PreWrapper))) for index := range lines { line := f.baseLineNumber + index highlight, next := f.shouldHighlight(highlightIndex, line) @@ -222,7 +238,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. fmt.Fprintf(w, "\n", f.styleAttr(css, chroma.LineTableTD, "width:100%")) } - fmt.Fprintf(w, f.preWrapper.Start(true, f.styleAttr(css, chroma.Background))) + fmt.Fprintf(w, f.preWrapper.Start(true, f.styleAttr(css, chroma.PreWrapper))) highlightIndex = 0 for index, tokens := range lines { @@ -232,14 +248,28 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. if next { highlightIndex++ } + + // Start of Line + fmt.Fprint(w, `", f.styleAttr(css, chroma.LineHighlight)) + // Line + LineHighlight + if f.Classes { + fmt.Fprintf(w, ` class="%s %s"`, f.class(chroma.Line), f.class(chroma.LineHighlight)) + } else { + fmt.Fprintf(w, ` style="%s %s"`, css[chroma.Line], css[chroma.LineHighlight]) + } + fmt.Fprint(w, `>`) + } else { + fmt.Fprintf(w, "%s>", f.styleAttr(css, chroma.Line)) } + // Line number if f.lineNumbers && !wrapInTable { fmt.Fprintf(w, "%s", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line)) } + fmt.Fprintf(w, ``, f.styleAttr(css, chroma.CodeLine)) + for _, token := range tokens { html := html.EscapeString(token.String()) attr := f.styleAttr(css, token.Type) @@ -248,9 +278,10 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma. } fmt.Fprint(w, html) } - if highlight { - fmt.Fprintf(w, "") - } + + fmt.Fprint(w, ``) // End of CodeLine + + fmt.Fprint(w, ``) // End of Line } fmt.Fprintf(w, f.preWrapper.End(true)) @@ -351,7 +382,11 @@ func (f *Formatter) tabWidthStyle() string { func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error { css := f.styleToCSS(style) // Special-case background as it is mapped to the outer ".chroma" class. - if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil { + if _, err := fmt.Fprintf(w, "/* %s */ .%sbg { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil { + return err + } + // Special-case PreWrapper as it is the ".chroma" class. + if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.PreWrapper, f.prefix, css[chroma.PreWrapper]); err != nil { return err } // Special-case code column of table to expand width. @@ -375,7 +410,8 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error { sort.Ints(tts) for _, ti := range tts { tt := chroma.TokenType(ti) - if tt == chroma.Background { + switch tt { + case chroma.Background, chroma.PreWrapper: continue } class := f.class(tt) @@ -405,12 +441,21 @@ func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string classes[t] = StyleEntryToCSS(entry) } classes[chroma.Background] += f.tabWidthStyle() - lineNumbersStyle := "margin-right: 0.4em; padding: 0 0.4em 0 0.4em;" + classes[chroma.PreWrapper] += classes[chroma.Background] + `;` + // Make PreWrapper a grid to show highlight style with full width. + if len(f.highlightRanges) > 0 { + classes[chroma.PreWrapper] += `display: grid;` + } + // Make PreWrapper wrap long lines. + if f.wrapLongLines { + classes[chroma.PreWrapper] += `white-space: pre-wrap; word-break: break-word;` + } + lineNumbersStyle := `white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;` // All rules begin with default rules followed by user provided rules + classes[chroma.Line] = `display: flex;` + classes[chroma.Line] classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers] classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable] - classes[chroma.LineHighlight] = "display: block; width: 100%;" + classes[chroma.LineHighlight] - classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block;" + classes[chroma.LineTable] + classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTable] classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD] return classes } diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go index 9043fa1c..055cbb37 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go @@ -20,7 +20,7 @@ var BashSession = internal.Register(MustNewLazyLexer( func bashsessionRules() Rules { return Rules{ "root": { - {`(^[#$%>]\s*)(.*\n?)`, ByGroups(GenericPrompt, Using(Bash)), nil}, + {`^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)`, ByGroups(GenericPrompt, Text, Using(Bash)), nil}, {`^.+\n?`, GenericOutput, nil}, }, } diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/b/bicep.go b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bicep.go new file mode 100644 index 00000000..ec136fbc --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/b/bicep.go @@ -0,0 +1,112 @@ +package b + +import ( + "strings" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Bicep lexer. +var Bicep = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Bicep", + Aliases: []string{"bicep"}, + Filenames: []string{"*.bicep"}, + }, + bicepRules, +)) + +func bicepRules() Rules { + bicepFunctions := []string{ + "any", + "array", + "concat", + "contains", + "empty", + "first", + "intersection", + "items", + "last", + "length", + "min", + "max", + "range", + "skip", + "take", + "union", + "dateTimeAdd", + "utcNow", + "deployment", + "environment", + "loadFileAsBase64", + "loadTextContent", + "int", + "json", + "extensionResourceId", + "getSecret", + "list", + "listKeys", + "listKeyValue", + "listAccountSas", + "listSecrets", + "pickZones", + "reference", + "resourceId", + "subscriptionResourceId", + "tenantResourceId", + "managementGroup", + "resourceGroup", + "subscription", + "tenant", + "base64", + "base64ToJson", + "base64ToString", + "dataUri", + "dataUriToString", + "endsWith", + "format", + "guid", + "indexOf", + "lastIndexOf", + "length", + "newGuid", + "padLeft", + "replace", + "split", + "startsWith", + "string", + "substring", + "toLower", + "toUpper", + "trim", + "uniqueString", + "uri", + "uriComponent", + "uriComponentToString", + } + + return Rules{ + "root": { + {`//[^\n\r]+`, CommentSingle, nil}, + {`/\*.*?\*/`, CommentMultiline, nil}, + {`([']?\w+[']?)(:)`, ByGroups(NameProperty, Punctuation), nil}, + {`\b('(resourceGroup|subscription|managementGroup|tenant)')\b`, KeywordNamespace, nil}, + {`'[\w\$\{\(\)\}\.]{1,}?'`, LiteralStringInterpol, nil}, + {`('''|').*?('''|')`, LiteralString, nil}, + {`\b(allowed|batchSize|description|maxLength|maxValue|metadata|minLength|minValue|secure)\b`, NameDecorator, nil}, + {`\b(az|sys)\.`, NameNamespace, nil}, + {`\b(` + strings.Join(bicepFunctions, "|") + `)\b`, NameFunction, nil}, + // https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-logical + {`\b(bool)(\()`, ByGroups(NameFunction, Punctuation), nil}, + {`\b(for|if|in)\b`, Keyword, nil}, + {`\b(module|output|param|resource|var)\b`, KeywordDeclaration, nil}, + {`\b(array|bool|int|object|string)\b`, KeywordType, nil}, + // https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/operators + {`(>=|>|<=|<|==|!=|=~|!~|::|&&|\?\?|!|-|%|\*|\/|\+)`, Operator, nil}, + {`[\(\)\[\]\.:\?{}@=]`, Punctuation, nil}, + {`[\w_-]+`, Text, nil}, + {`\s+`, TextWhitespace, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go b/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go index 725bcb86..4776864d 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/c/csharp.go @@ -24,7 +24,8 @@ func cSharpRules() Rules { {`^\s*\[.*?\]`, NameAttribute, nil}, {`[^\S\n]+`, Text, nil}, {`\\\n`, Text, nil}, - {`//.*?\n`, CommentSingle, nil}, + {`///[^\n\r]+`, CommentSpecial, nil}, + {`//[^\n\r]+`, CommentSingle, nil}, {`/[*].*?[*]/`, CommentMultiline, nil}, {`\n`, Text, nil}, {`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil}, @@ -34,12 +35,12 @@ func cSharpRules() Rules { {`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil}, {`'\\.'|'[^\\]'`, LiteralStringChar, nil}, {`0[xX][0-9a-fA-F]+[Ll]?|[0-9_](\.[0-9]*)?([eE][+-]?[0-9]+)?[flFLdD]?`, LiteralNumber, nil}, - {`#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil}, + {`#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma|nullable)\b[^\n\r]+`, CommentPreproc, nil}, {`\b(extern)(\s+)(alias)\b`, ByGroups(Keyword, Text, Keyword), nil}, - {`(abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b`, Keyword, nil}, + {`(abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|init|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b`, Keyword, nil}, {`(global)(::)`, ByGroups(Keyword, Punctuation), nil}, {`(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??`, KeywordType, nil}, - {`(class|struct)(\s+)`, ByGroups(Keyword, Text), Push("class")}, + {`(class|struct|record|interface)(\s+)`, ByGroups(Keyword, Text), Push("class")}, {`(namespace|using)(\s+)`, ByGroups(Keyword, Text), Push("namespace")}, {`@?[_a-zA-Z]\w*`, Name, nil}, }, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go b/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go index b6be884e..deb182e9 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go @@ -18,7 +18,7 @@ var Kotlin = internal.Register(MustNewLazyLexer( )) func kotlinRules() Rules { - const kotlinIdentifier = "(?:[_\\p{L}][\\p{L}\\p{N}]*|`@?[_\\p{L}][\\p{L}\\p{N}]+)" + const kotlinIdentifier = "(?:[_\\p{L}][\\p{L}\\p{N}]*|`@?[_\\p{L}][\\p{L}\\p{N}]+`)" return Rules{ "root": { diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/o/openedgeabl.go b/backend/vendor/github.com/alecthomas/chroma/lexers/o/openedgeabl.go new file mode 100644 index 00000000..55619711 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/o/openedgeabl.go @@ -0,0 +1,50 @@ +package o + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// OpenedgeAbl lexer. +var OpenEdgeABL = internal.Register(MustNewLazyLexer( + &Config{ + Name: "OpenEdge ABL", + Aliases: []string{"openedge", "abl", "progress", "openedgeabl"}, + Filenames: []string{"*.p", "*.cls", "*.w", "*.i"}, + MimeTypes: []string{"text/x-openedge", "application/x-openedge"}, + }, + func() Rules { + return Rules{ + "root": { + {`/\*`, CommentMultiline, Push("comment")}, + {`//.*?$`, CommentSingle, nil}, + {`\{`, CommentPreproc, Push("preprocessor")}, + {`\s*&.*`, CommentPreproc, nil}, + {`0[xX][0-9a-fA-F]+[LlUu]*`, LiteralNumberHex, nil}, + {`(?i)(DEFINE|DEF|DEFI|DEFIN)\b`, KeywordDeclaration, nil}, + {`(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|COM-HANDLE|DATE|DATETIME|DATETIME-TZ|DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|INT64|INTEGER|INT|INTE|INTEG|INTEGE|LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^\w\-]))`, KeywordType, nil}, + {Words(`(?i)(^|(?<=[^\w\-]))`, `\s*($|(?=[^\w\-]))`, `ABS`, `ABSO`, `ABSOL`, `ABSOLU`, `ABSOLUT`, `ABSOLUTE`, `ABSTRACT`, `ACCELERATOR`, `ACCUM`, `ACCUMU`, `ACCUMUL`, `ACCUMULA`, `ACCUMULAT`, `ACCUMULATE`, `ACTIVE-FORM`, `ACTIVE-WINDOW`, `ADD`, `ADD-BUFFER`, `ADD-CALC-COLUMN`, `ADD-COLUMNS-FROM`, `ADD-EVENTS-PROCEDURE`, `ADD-FIELDS-FROM`, `ADD-FIRST`, `ADD-INDEX-FIELD`, `ADD-LAST`, `ADD-LIKE-COLUMN`, `ADD-LIKE-FIELD`, `ADD-LIKE-INDEX`, `ADD-NEW-FIELD`, `ADD-NEW-INDEX`, `ADD-SCHEMA-LOCATION`, `ADD-SUPER-PROCEDURE`, `ADM-DATA`, `ADVISE`, `ALERT-BOX`, `ALIAS`, `ALL`, `ALLOW-COLUMN-SEARCHING`, `ALLOW-REPLICATION`, `ALTER`, `ALWAYS-ON-TOP`, `AMBIG`, `AMBIGU`, `AMBIGUO`, `AMBIGUOU`, `AMBIGUOUS`, `ANALYZ`, `ANALYZE`, `AND`, `ANSI-ONLY`, `ANY`, `ANYWHERE`, `APPEND`, `APPL-ALERT`, `APPL-ALERT-`, `APPL-ALERT-B`, `APPL-ALERT-BO`, `APPL-ALERT-BOX`, `APPL-ALERT-BOXE`, `APPL-ALERT-BOXES`, `APPL-CONTEXT-ID`, `APPLICATION`, `APPLY`, `APPSERVER-INFO`, `APPSERVER-PASSWORD`, `APPSERVER-USERID`, `ARRAY-MESSAGE`, `AS`, `ASC`, `ASCE`, `ASCEN`, `ASCEND`, `ASCENDI`, `ASCENDIN`, `ASCENDING`, `ASK-OVERWRITE`, `ASSEMBLY`, `ASSIGN`, `ASYNC-REQUEST-COUNT`, `ASYNC-REQUEST-HANDLE`, `ASYNCHRONOUS`, `AT`, `ATTACHED-PAIRLIST`, `ATTR`, `ATTR-SPACE`, `ATTRI`, `ATTRIB`, `ATTRIBU`, `ATTRIBUT`, `AUDIT-CONTROL`, `AUDIT-ENABLED`, `AUDIT-EVENT-CONTEXT`, `AUDIT-POLICY`, `AUTHENTICATION-FAILED`, `AUTHORIZATION`, `AUTO-COMP`, `AUTO-COMPL`, `AUTO-COMPLE`, `AUTO-COMPLET`, `AUTO-COMPLETI`, `AUTO-COMPLETIO`, `AUTO-COMPLETION`, `AUTO-END-KEY`, `AUTO-ENDKEY`, `AUTO-GO`, `AUTO-IND`, `AUTO-INDE`, `AUTO-INDEN`, `AUTO-INDENT`, `AUTO-RESIZE`, `AUTO-RET`, `AUTO-RETU`, `AUTO-RETUR`, `AUTO-RETURN`, `AUTO-SYNCHRONIZE`, `AUTO-Z`, `AUTO-ZA`, `AUTO-ZAP`, `AUTOMATIC`, `AVAIL`, `AVAILA`, `AVAILAB`, `AVAILABL`, `AVAILABLE`, `AVAILABLE-FORMATS`, `AVE`, `AVER`, `AVERA`, `AVERAG`, `AVERAGE`, `AVG`, `BACK`, `BACKG`, `BACKGR`, `BACKGRO`, `BACKGROU`, `BACKGROUN`, `BACKGROUND`, `BACKWARD`, `BACKWARDS`, `BASE64-DECODE`, `BASE64-ENCODE`, `BASE-ADE`, `BASE-KEY`, `BATCH`, `BATCH-`, `BATCH-M`, `BATCH-MO`, `BATCH-MOD`, `BATCH-MODE`, `BATCH-SIZE`, `BEFORE-H`, `BEFORE-HI`, `BEFORE-HID`, `BEFORE-HIDE`, `BEGIN-EVENT-GROUP`, `BEGINS`, `BELL`, `BETWEEN`, `BGC`, `BGCO`, `BGCOL`, `BGCOLO`, `BGCOLOR`, `BIG-ENDIAN`, `BINARY`, `BIND`, `BIND-WHERE`, `BLANK`, `BLOCK-ITERATION-DISPLAY`, `BLOCK-LEVEL`, `BORDER-B`, `BORDER-BO`, `BORDER-BOT`, `BORDER-BOTT`, `BORDER-BOTTO`, `BORDER-BOTTOM-CHARS`, `BORDER-BOTTOM-P`, `BORDER-BOTTOM-PI`, `BORDER-BOTTOM-PIX`, `BORDER-BOTTOM-PIXE`, `BORDER-BOTTOM-PIXEL`, `BORDER-BOTTOM-PIXELS`, `BORDER-L`, `BORDER-LE`, `BORDER-LEF`, `BORDER-LEFT`, `BORDER-LEFT-`, `BORDER-LEFT-C`, `BORDER-LEFT-CH`, `BORDER-LEFT-CHA`, `BORDER-LEFT-CHAR`, `BORDER-LEFT-CHARS`, `BORDER-LEFT-P`, `BORDER-LEFT-PI`, `BORDER-LEFT-PIX`, `BORDER-LEFT-PIXE`, `BORDER-LEFT-PIXEL`, `BORDER-LEFT-PIXELS`, `BORDER-R`, `BORDER-RI`, `BORDER-RIG`, `BORDER-RIGH`, `BORDER-RIGHT`, `BORDER-RIGHT-`, `BORDER-RIGHT-C`, `BORDER-RIGHT-CH`, `BORDER-RIGHT-CHA`, `BORDER-RIGHT-CHAR`, `BORDER-RIGHT-CHARS`, `BORDER-RIGHT-P`, `BORDER-RIGHT-PI`, `BORDER-RIGHT-PIX`, `BORDER-RIGHT-PIXE`, `BORDER-RIGHT-PIXEL`, `BORDER-RIGHT-PIXELS`, `BORDER-T`, `BORDER-TO`, `BORDER-TOP`, `BORDER-TOP-`, `BORDER-TOP-C`, `BORDER-TOP-CH`, `BORDER-TOP-CHA`, `BORDER-TOP-CHAR`, `BORDER-TOP-CHARS`, `BORDER-TOP-P`, `BORDER-TOP-PI`, `BORDER-TOP-PIX`, `BORDER-TOP-PIXE`, `BORDER-TOP-PIXEL`, `BORDER-TOP-PIXELS`, `BOX`, `BOX-SELECT`, `BOX-SELECTA`, `BOX-SELECTAB`, `BOX-SELECTABL`, `BOX-SELECTABLE`, `BREAK`, `BROWSE`, `BUFFER`, `BUFFER-CHARS`, `BUFFER-COMPARE`, `BUFFER-COPY`, `BUFFER-CREATE`, `BUFFER-DELETE`, `BUFFER-FIELD`, `BUFFER-HANDLE`, `BUFFER-LINES`, `BUFFER-NAME`, `BUFFER-PARTITION-ID`, `BUFFER-RELEASE`, `BUFFER-VALUE`, `BUTTON`, `BUTTONS`, `BY`, `BY-POINTER`, `BY-VARIANT-POINTER`, `CACHE`, `CACHE-SIZE`, `CALL`, `CALL-NAME`, `CALL-TYPE`, `CAN-CREATE`, `CAN-DELETE`, `CAN-DO`, `CAN-DO-DOMAIN-SUPPORT`, `CAN-FIND`, `CAN-QUERY`, `CAN-READ`, `CAN-SET`, `CAN-WRITE`, `CANCEL-BREAK`, `CANCEL-BUTTON`, `CAPS`, `CAREFUL-PAINT`, `CASE`, `CASE-SEN`, `CASE-SENS`, `CASE-SENSI`, `CASE-SENSIT`, `CASE-SENSITI`, `CASE-SENSITIV`, `CASE-SENSITIVE`, `CAST`, `CATCH`, `CDECL`, `CENTER`, `CENTERE`, `CENTERED`, `CHAINED`, `CHARACTER`, `CHARACTER_LENGTH`, `CHARSET`, `CHECK`, `CHECKED`, `CHOOSE`, `CHR`, `CLASS`, `CLASS-TYPE`, `CLEAR`, `CLEAR-APPL-CONTEXT`, `CLEAR-LOG`, `CLEAR-SELECT`, `CLEAR-SELECTI`, `CLEAR-SELECTIO`, `CLEAR-SELECTION`, `CLEAR-SORT-ARROW`, `CLEAR-SORT-ARROWS`, `CLIENT-CONNECTION-ID`, `CLIENT-PRINCIPAL`, `CLIENT-TTY`, `CLIENT-TYPE`, `CLIENT-WORKSTATION`, `CLIPBOARD`, `CLOSE`, `CLOSE-LOG`, `CODE`, `CODEBASE-LOCATOR`, `CODEPAGE`, `CODEPAGE-CONVERT`, `COL`, `COL-OF`, `COLLATE`, `COLON`, `COLON-ALIGN`, `COLON-ALIGNE`, `COLON-ALIGNED`, `COLOR`, `COLOR-TABLE`, `COLU`, `COLUM`, `COLUMN`, `COLUMN-BGCOLOR`, `COLUMN-DCOLOR`, `COLUMN-FGCOLOR`, `COLUMN-FONT`, `COLUMN-LAB`, `COLUMN-LABE`, `COLUMN-LABEL`, `COLUMN-MOVABLE`, `COLUMN-OF`, `COLUMN-PFCOLOR`, `COLUMN-READ-ONLY`, `COLUMN-RESIZABLE`, `COLUMN-SCROLLING`, `COLUMNS`, `COM-HANDLE`, `COM-SELF`, `COMBO-BOX`, `COMMAND`, `COMPARES`, `COMPILE`, `COMPILER`, `COMPLETE`, `CONFIG-NAME`, `CONNECT`, `CONNECTED`, `CONSTRUCTOR`, `CONTAINS`, `CONTENTS`, `CONTEXT`, `CONTEXT-HELP`, `CONTEXT-HELP-FILE`, `CONTEXT-HELP-ID`, `CONTEXT-POPUP`, `CONTROL`, `CONTROL-BOX`, `CONTROL-FRAME`, `CONVERT`, `CONVERT-3D-COLORS`, `CONVERT-TO-OFFS`, `CONVERT-TO-OFFSE`, `CONVERT-TO-OFFSET`, `COPY-DATASET`, `COPY-LOB`, `COPY-SAX-ATTRIBUTES`, `COPY-TEMP-TABLE`, `COUNT`, `COUNT-OF`, `CPCASE`, `CPCOLL`, `CPINTERNAL`, `CPLOG`, `CPPRINT`, `CPRCODEIN`, `CPRCODEOUT`, `CPSTREAM`, `CPTERM`, `CRC-VALUE`, `CREATE`, `CREATE-LIKE`, `CREATE-LIKE-SEQUENTIAL`, `CREATE-NODE-NAMESPACE`, `CREATE-RESULT-LIST-ENTRY`, `CREATE-TEST-FILE`, `CURRENT`, `CURRENT-CHANGED`, `CURRENT-COLUMN`, `CURRENT-ENV`, `CURRENT-ENVI`, `CURRENT-ENVIR`, `CURRENT-ENVIRO`, `CURRENT-ENVIRON`, `CURRENT-ENVIRONM`, `CURRENT-ENVIRONME`, `CURRENT-ENVIRONMEN`, `CURRENT-ENVIRONMENT`, `CURRENT-ITERATION`, `CURRENT-LANG`, `CURRENT-LANGU`, `CURRENT-LANGUA`, `CURRENT-LANGUAG`, `CURRENT-LANGUAGE`, `CURRENT-QUERY`, `CURRENT-REQUEST-INFO`, `CURRENT-RESPONSE-INFO`, `CURRENT-RESULT-ROW`, `CURRENT-ROW-MODIFIED`, `CURRENT-VALUE`, `CURRENT-WINDOW`, `CURRENT_DATE`, `CURS`, `CURSO`, `CURSOR`, `CURSOR-CHAR`, `CURSOR-LINE`, `CURSOR-OFFSET`, `DATA-BIND`, `DATA-ENTRY-RET`, `DATA-ENTRY-RETU`, `DATA-ENTRY-RETUR`, `DATA-ENTRY-RETURN`, `DATA-REL`, `DATA-RELA`, `DATA-RELAT`, `DATA-RELATI`, `DATA-RELATIO`, `DATA-RELATION`, `DATA-SOURCE`, `DATA-SOURCE-COMPLETE-MAP`, `DATA-SOURCE-MODIFIED`, `DATA-SOURCE-ROWID`, `DATA-T`, `DATA-TY`, `DATA-TYP`, `DATA-TYPE`, `DATABASE`, `DATASERVERS`, `DATASET`, `DATASET-HANDLE`, `DATE`, `DATE-F`, `DATE-FO`, `DATE-FOR`, `DATE-FORM`, `DATE-FORMA`, `DATE-FORMAT`, `DAY`, `DB-CONTEXT`, `DB-REFERENCES`, `DBCODEPAGE`, `DBCOLLATION`, `DBNAME`, `DBPARAM`, `DBREST`, `DBRESTR`, `DBRESTRI`, `DBRESTRIC`, `DBRESTRICT`, `DBRESTRICTI`, `DBRESTRICTIO`, `DBRESTRICTION`, `DBRESTRICTIONS`, `DBTASKID`, `DBTYPE`, `DBVERS`, `DBVERSI`, `DBVERSIO`, `DBVERSION`, `DCOLOR`, `DDE`, `DDE-ERROR`, `DDE-I`, `DDE-ID`, `DDE-ITEM`, `DDE-NAME`, `DDE-TOPIC`, `DEBLANK`, `DEBU`, `DEBUG`, `DEBUG-ALERT`, `DEBUG-LIST`, `DEBUGGER`, `DECIMAL`, `DECIMALS`, `DECLARE`, `DECLARE-NAMESPACE`, `DECRYPT`, `DEFAULT`, `DEFAULT-B`, `DEFAULT-BU`, `DEFAULT-BUFFER-HANDLE`, `DEFAULT-BUT`, `DEFAULT-BUTT`, `DEFAULT-BUTTO`, `DEFAULT-BUTTON`, `DEFAULT-COMMIT`, `DEFAULT-EX`, `DEFAULT-EXT`, `DEFAULT-EXTE`, `DEFAULT-EXTEN`, `DEFAULT-EXTENS`, `DEFAULT-EXTENSI`, `DEFAULT-EXTENSIO`, `DEFAULT-EXTENSION`, `DEFAULT-NOXL`, `DEFAULT-NOXLA`, `DEFAULT-NOXLAT`, `DEFAULT-NOXLATE`, `DEFAULT-VALUE`, `DEFAULT-WINDOW`, `DEFINE`, `DEFINE-USER-EVENT-MANAGER`, `DEFINED`, `DEL`, `DELE`, `DELEGATE`, `DELET`, `DELETE PROCEDURE`, `DELETE`, `DELETE-CHAR`, `DELETE-CHARA`, `DELETE-CHARAC`, `DELETE-CHARACT`, `DELETE-CHARACTE`, `DELETE-CHARACTER`, `DELETE-CURRENT-ROW`, `DELETE-LINE`, `DELETE-RESULT-LIST-ENTRY`, `DELETE-SELECTED-ROW`, `DELETE-SELECTED-ROWS`, `DELIMITER`, `DESC`, `DESCE`, `DESCEN`, `DESCEND`, `DESCENDI`, `DESCENDIN`, `DESCENDING`, `DESELECT-FOCUSED-ROW`, `DESELECT-ROWS`, `DESELECT-SELECTED-ROW`, `DESELECTION`, `DESTRUCTOR`, `DIALOG-BOX`, `DICT`, `DICTI`, `DICTIO`, `DICTION`, `DICTIONA`, `DICTIONAR`, `DICTIONARY`, `DIR`, `DISABLE`, `DISABLE-AUTO-ZAP`, `DISABLE-DUMP-TRIGGERS`, `DISABLE-LOAD-TRIGGERS`, `DISABLED`, `DISCON`, `DISCONN`, `DISCONNE`, `DISCONNEC`, `DISCONNECT`, `DISP`, `DISPL`, `DISPLA`, `DISPLAY`, `DISPLAY-MESSAGE`, `DISPLAY-T`, `DISPLAY-TY`, `DISPLAY-TYP`, `DISPLAY-TYPE`, `DISTINCT`, `DO`, `DOMAIN-DESCRIPTION`, `DOMAIN-NAME`, `DOMAIN-TYPE`, `DOS`, `DOUBLE`, `DOWN`, `DRAG-ENABLED`, `DROP`, `DROP-DOWN`, `DROP-DOWN-LIST`, `DROP-FILE-NOTIFY`, `DROP-TARGET`, `DS-CLOSE-CURSOR`, `DSLOG-MANAGER`, `DUMP`, `DYNAMIC`, `DYNAMIC-ENUM`, `DYNAMIC-FUNCTION`, `DYNAMIC-INVOKE`, `EACH`, `ECHO`, `EDGE`, `EDGE-`, `EDGE-C`, `EDGE-CH`, `EDGE-CHA`, `EDGE-CHAR`, `EDGE-CHARS`, `EDGE-P`, `EDGE-PI`, `EDGE-PIX`, `EDGE-PIXE`, `EDGE-PIXEL`, `EDGE-PIXELS`, `EDIT-CAN-PASTE`, `EDIT-CAN-UNDO`, `EDIT-CLEAR`, `EDIT-COPY`, `EDIT-CUT`, `EDIT-PASTE`, `EDIT-UNDO`, `EDITING`, `EDITOR`, `ELSE`, `EMPTY`, `EMPTY-TEMP-TABLE`, `ENABLE`, `ENABLED-FIELDS`, `ENCODE`, `ENCRYPT`, `ENCRYPT-AUDIT-MAC-KEY`, `ENCRYPTION-SALT`, `END`, `END-DOCUMENT`, `END-ELEMENT`, `END-EVENT-GROUP`, `END-FILE-DROP`, `END-KEY`, `END-MOVE`, `END-RESIZE`, `END-ROW-RESIZE`, `END-USER-PROMPT`, `ENDKEY`, `ENTERED`, `ENTITY-EXPANSION-LIMIT`, `ENTRY`, `ENUM`, `EQ`, `ERROR`, `ERROR-COL`, `ERROR-COLU`, `ERROR-COLUM`, `ERROR-COLUMN`, `ERROR-ROW`, `ERROR-STACK-TRACE`, `ERROR-STAT`, `ERROR-STATU`, `ERROR-STATUS`, `ESCAPE`, `ETIME`, `EVENT`, `EVENT-GROUP-ID`, `EVENT-PROCEDURE`, `EVENT-PROCEDURE-CONTEXT`, `EVENT-T`, `EVENT-TY`, `EVENT-TYP`, `EVENT-TYPE`, `EVENTS`, `EXCEPT`, `EXCLUSIVE`, `EXCLUSIVE-`, `EXCLUSIVE-ID`, `EXCLUSIVE-L`, `EXCLUSIVE-LO`, `EXCLUSIVE-LOC`, `EXCLUSIVE-LOCK`, `EXCLUSIVE-WEB-USER`, `EXECUTE`, `EXISTS`, `EXP`, `EXPAND`, `EXPANDABLE`, `EXPLICIT`, `EXPORT`, `EXPORT-PRINCIPAL`, `EXTENDED`, `EXTENT`, `EXTERNAL`, `FALSE`, `FETCH`, `FETCH-SELECTED-ROW`, `FGC`, `FGCO`, `FGCOL`, `FGCOLO`, `FGCOLOR`, `FIELD`, `FIELDS`, `FILE`, `FILE-CREATE-DATE`, `FILE-CREATE-TIME`, `FILE-INFO`, `FILE-INFOR`, `FILE-INFORM`, `FILE-INFORMA`, `FILE-INFORMAT`, `FILE-INFORMATI`, `FILE-INFORMATIO`, `FILE-INFORMATION`, `FILE-MOD-DATE`, `FILE-MOD-TIME`, `FILE-NAME`, `FILE-OFF`, `FILE-OFFS`, `FILE-OFFSE`, `FILE-OFFSET`, `FILE-SIZE`, `FILE-TYPE`, `FILENAME`, `FILL`, `FILL-IN`, `FILLED`, `FILTERS`, `FINAL`, `FINALLY`, `FIND`, `FIND-BY-ROWID`, `FIND-CASE-SENSITIVE`, `FIND-CURRENT`, `FIND-FIRST`, `FIND-GLOBAL`, `FIND-LAST`, `FIND-NEXT-OCCURRENCE`, `FIND-PREV-OCCURRENCE`, `FIND-SELECT`, `FIND-UNIQUE`, `FIND-WRAP-AROUND`, `FINDER`, `FIRST`, `FIRST-ASYNCH-REQUEST`, `FIRST-CHILD`, `FIRST-COLUMN`, `FIRST-FORM`, `FIRST-OBJECT`, `FIRST-OF`, `FIRST-PROC`, `FIRST-PROCE`, `FIRST-PROCED`, `FIRST-PROCEDU`, `FIRST-PROCEDUR`, `FIRST-PROCEDURE`, `FIRST-SERVER`, `FIRST-TAB-I`, `FIRST-TAB-IT`, `FIRST-TAB-ITE`, `FIRST-TAB-ITEM`, `FIT-LAST-COLUMN`, `FIXED-ONLY`, `FLAT-BUTTON`, `FLOAT`, `FOCUS`, `FOCUSED-ROW`, `FOCUSED-ROW-SELECTED`, `FONT`, `FONT-TABLE`, `FOR`, `FORCE-FILE`, `FORE`, `FOREG`, `FOREGR`, `FOREGRO`, `FOREGROU`, `FOREGROUN`, `FOREGROUND`, `FORM INPUT`, `FORM`, `FORM-LONG-INPUT`, `FORMA`, `FORMAT`, `FORMATTE`, `FORMATTED`, `FORWARD`, `FORWARDS`, `FRAGMEN`, `FRAGMENT`, `FRAM`, `FRAME`, `FRAME-COL`, `FRAME-DB`, `FRAME-DOWN`, `FRAME-FIELD`, `FRAME-FILE`, `FRAME-INDE`, `FRAME-INDEX`, `FRAME-LINE`, `FRAME-NAME`, `FRAME-ROW`, `FRAME-SPA`, `FRAME-SPAC`, `FRAME-SPACI`, `FRAME-SPACIN`, `FRAME-SPACING`, `FRAME-VAL`, `FRAME-VALU`, `FRAME-VALUE`, `FRAME-X`, `FRAME-Y`, `FREQUENCY`, `FROM`, `FROM-C`, `FROM-CH`, `FROM-CHA`, `FROM-CHAR`, `FROM-CHARS`, `FROM-CUR`, `FROM-CURR`, `FROM-CURRE`, `FROM-CURREN`, `FROM-CURRENT`, `FROM-P`, `FROM-PI`, `FROM-PIX`, `FROM-PIXE`, `FROM-PIXEL`, `FROM-PIXELS`, `FULL-HEIGHT`, `FULL-HEIGHT-`, `FULL-HEIGHT-C`, `FULL-HEIGHT-CH`, `FULL-HEIGHT-CHA`, `FULL-HEIGHT-CHAR`, `FULL-HEIGHT-CHARS`, `FULL-HEIGHT-P`, `FULL-HEIGHT-PI`, `FULL-HEIGHT-PIX`, `FULL-HEIGHT-PIXE`, `FULL-HEIGHT-PIXEL`, `FULL-HEIGHT-PIXELS`, `FULL-PATHN`, `FULL-PATHNA`, `FULL-PATHNAM`, `FULL-PATHNAME`, `FULL-WIDTH`, `FULL-WIDTH-`, `FULL-WIDTH-C`, `FULL-WIDTH-CH`, `FULL-WIDTH-CHA`, `FULL-WIDTH-CHAR`, `FULL-WIDTH-CHARS`, `FULL-WIDTH-P`, `FULL-WIDTH-PI`, `FULL-WIDTH-PIX`, `FULL-WIDTH-PIXE`, `FULL-WIDTH-PIXEL`, `FULL-WIDTH-PIXELS`, `FUNCTION`, `FUNCTION-CALL-TYPE`, `GATEWAY`, `GATEWAYS`, `GE`, `GENERATE-MD5`, `GENERATE-PBE-KEY`, `GENERATE-PBE-SALT`, `GENERATE-RANDOM-KEY`, `GENERATE-UUID`, `GET`, `GET-ATTR-CALL-TYPE`, `GET-ATTRIBUTE-NODE`, `GET-BINARY-DATA`, `GET-BLUE`, `GET-BLUE-`, `GET-BLUE-V`, `GET-BLUE-VA`, `GET-BLUE-VAL`, `GET-BLUE-VALU`, `GET-BLUE-VALUE`, `GET-BROWSE-COLUMN`, `GET-BUFFER-HANDLE`, `GET-BYTE`, `GET-CALLBACK-PROC-CONTEXT`, `GET-CALLBACK-PROC-NAME`, `GET-CGI-LIST`, `GET-CGI-LONG-VALUE`, `GET-CGI-VALUE`, `GET-CLASS`, `GET-CODEPAGES`, `GET-COLLATIONS`, `GET-CONFIG-VALUE`, `GET-CURRENT`, `GET-DOUBLE`, `GET-DROPPED-FILE`, `GET-DYNAMIC`, `GET-ERROR-COLUMN`, `GET-ERROR-ROW`, `GET-FILE`, `GET-FILE-NAME`, `GET-FILE-OFFSE`, `GET-FILE-OFFSET`, `GET-FIRST`, `GET-FLOAT`, `GET-GREEN`, `GET-GREEN-`, `GET-GREEN-V`, `GET-GREEN-VA`, `GET-GREEN-VAL`, `GET-GREEN-VALU`, `GET-GREEN-VALUE`, `GET-INDEX-BY-NAMESPACE-NAME`, `GET-INDEX-BY-QNAME`, `GET-INT64`, `GET-ITERATION`, `GET-KEY-VAL`, `GET-KEY-VALU`, `GET-KEY-VALUE`, `GET-LAST`, `GET-LOCALNAME-BY-INDEX`, `GET-LONG`, `GET-MESSAGE`, `GET-NEXT`, `GET-NUMBER`, `GET-POINTER-VALUE`, `GET-PREV`, `GET-PRINTERS`, `GET-PROPERTY`, `GET-QNAME-BY-INDEX`, `GET-RED`, `GET-RED-`, `GET-RED-V`, `GET-RED-VA`, `GET-RED-VAL`, `GET-RED-VALU`, `GET-RED-VALUE`, `GET-REPOSITIONED-ROW`, `GET-RGB-VALUE`, `GET-SELECTED`, `GET-SELECTED-`, `GET-SELECTED-W`, `GET-SELECTED-WI`, `GET-SELECTED-WID`, `GET-SELECTED-WIDG`, `GET-SELECTED-WIDGE`, `GET-SELECTED-WIDGET`, `GET-SHORT`, `GET-SIGNATURE`, `GET-SIZE`, `GET-STRING`, `GET-TAB-ITEM`, `GET-TEXT-HEIGHT`, `GET-TEXT-HEIGHT-`, `GET-TEXT-HEIGHT-C`, `GET-TEXT-HEIGHT-CH`, `GET-TEXT-HEIGHT-CHA`, `GET-TEXT-HEIGHT-CHAR`, `GET-TEXT-HEIGHT-CHARS`, `GET-TEXT-HEIGHT-P`, `GET-TEXT-HEIGHT-PI`, `GET-TEXT-HEIGHT-PIX`, `GET-TEXT-HEIGHT-PIXE`, `GET-TEXT-HEIGHT-PIXEL`, `GET-TEXT-HEIGHT-PIXELS`, `GET-TEXT-WIDTH`, `GET-TEXT-WIDTH-`, `GET-TEXT-WIDTH-C`, `GET-TEXT-WIDTH-CH`, `GET-TEXT-WIDTH-CHA`, `GET-TEXT-WIDTH-CHAR`, `GET-TEXT-WIDTH-CHARS`, `GET-TEXT-WIDTH-P`, `GET-TEXT-WIDTH-PI`, `GET-TEXT-WIDTH-PIX`, `GET-TEXT-WIDTH-PIXE`, `GET-TEXT-WIDTH-PIXEL`, `GET-TEXT-WIDTH-PIXELS`, `GET-TYPE-BY-INDEX`, `GET-TYPE-BY-NAMESPACE-NAME`, `GET-TYPE-BY-QNAME`, `GET-UNSIGNED-LONG`, `GET-UNSIGNED-SHORT`, `GET-URI-BY-INDEX`, `GET-VALUE-BY-INDEX`, `GET-VALUE-BY-NAMESPACE-NAME`, `GET-VALUE-BY-QNAME`, `GET-WAIT-STATE`, `GETBYTE`, `GLOBAL`, `GO-ON`, `GO-PEND`, `GO-PENDI`, `GO-PENDIN`, `GO-PENDING`, `GRANT`, `GRAPHIC-E`, `GRAPHIC-ED`, `GRAPHIC-EDG`, `GRAPHIC-EDGE`, `GRID-FACTOR-H`, `GRID-FACTOR-HO`, `GRID-FACTOR-HOR`, `GRID-FACTOR-HORI`, `GRID-FACTOR-HORIZ`, `GRID-FACTOR-HORIZO`, `GRID-FACTOR-HORIZON`, `GRID-FACTOR-HORIZONT`, `GRID-FACTOR-HORIZONTA`, `GRID-FACTOR-HORIZONTAL`, `GRID-FACTOR-V`, `GRID-FACTOR-VE`, `GRID-FACTOR-VER`, `GRID-FACTOR-VERT`, `GRID-FACTOR-VERTI`, `GRID-FACTOR-VERTIC`, `GRID-FACTOR-VERTICA`, `GRID-FACTOR-VERTICAL`, `GRID-SNAP`, `GRID-UNIT-HEIGHT`, `GRID-UNIT-HEIGHT-`, `GRID-UNIT-HEIGHT-C`, `GRID-UNIT-HEIGHT-CH`, `GRID-UNIT-HEIGHT-CHA`, `GRID-UNIT-HEIGHT-CHARS`, `GRID-UNIT-HEIGHT-P`, `GRID-UNIT-HEIGHT-PI`, `GRID-UNIT-HEIGHT-PIX`, `GRID-UNIT-HEIGHT-PIXE`, `GRID-UNIT-HEIGHT-PIXEL`, `GRID-UNIT-HEIGHT-PIXELS`, `GRID-UNIT-WIDTH`, `GRID-UNIT-WIDTH-`, `GRID-UNIT-WIDTH-C`, `GRID-UNIT-WIDTH-CH`, `GRID-UNIT-WIDTH-CHA`, `GRID-UNIT-WIDTH-CHAR`, `GRID-UNIT-WIDTH-CHARS`, `GRID-UNIT-WIDTH-P`, `GRID-UNIT-WIDTH-PI`, `GRID-UNIT-WIDTH-PIX`, `GRID-UNIT-WIDTH-PIXE`, `GRID-UNIT-WIDTH-PIXEL`, `GRID-UNIT-WIDTH-PIXELS`, `GRID-VISIBLE`, `GROUP`, `GT`, `GUID`, `HANDLE`, `HANDLER`, `HAS-RECORDS`, `HAVING`, `HEADER`, `HEIGHT`, `HEIGHT-`, `HEIGHT-C`, `HEIGHT-CH`, `HEIGHT-CHA`, `HEIGHT-CHAR`, `HEIGHT-CHARS`, `HEIGHT-P`, `HEIGHT-PI`, `HEIGHT-PIX`, `HEIGHT-PIXE`, `HEIGHT-PIXEL`, `HEIGHT-PIXELS`, `HELP`, `HEX-DECODE`, `HEX-ENCODE`, `HIDDEN`, `HIDE`, `HORI`, `HORIZ`, `HORIZO`, `HORIZON`, `HORIZONT`, `HORIZONTA`, `HORIZONTAL`, `HOST-BYTE-ORDER`, `HTML-CHARSET`, `HTML-END-OF-LINE`, `HTML-END-OF-PAGE`, `HTML-FRAME-BEGIN`, `HTML-FRAME-END`, `HTML-HEADER-BEGIN`, `HTML-HEADER-END`, `HTML-TITLE-BEGIN`, `HTML-TITLE-END`, `HWND`, `ICON`, `IF`, `IMAGE`, `IMAGE-DOWN`, `IMAGE-INSENSITIVE`, `IMAGE-SIZE`, `IMAGE-SIZE-C`, `IMAGE-SIZE-CH`, `IMAGE-SIZE-CHA`, `IMAGE-SIZE-CHAR`, `IMAGE-SIZE-CHARS`, `IMAGE-SIZE-P`, `IMAGE-SIZE-PI`, `IMAGE-SIZE-PIX`, `IMAGE-SIZE-PIXE`, `IMAGE-SIZE-PIXEL`, `IMAGE-SIZE-PIXELS`, `IMAGE-UP`, `IMMEDIATE-DISPLAY`, `IMPLEMENTS`, `IMPORT`, `IMPORT-PRINCIPAL`, `IN`, `IN-HANDLE`, `INCREMENT-EXCLUSIVE-ID`, `INDEX`, `INDEX-HINT`, `INDEX-INFORMATION`, `INDEXED-REPOSITION`, `INDICATOR`, `INFO`, `INFOR`, `INFORM`, `INFORMA`, `INFORMAT`, `INFORMATI`, `INFORMATIO`, `INFORMATION`, `INHERIT-BGC`, `INHERIT-BGCO`, `INHERIT-BGCOL`, `INHERIT-BGCOLO`, `INHERIT-BGCOLOR`, `INHERIT-FGC`, `INHERIT-FGCO`, `INHERIT-FGCOL`, `INHERIT-FGCOLO`, `INHERIT-FGCOLOR`, `INHERITS`, `INIT`, `INITI`, `INITIA`, `INITIAL`, `INITIAL-DIR`, `INITIAL-FILTER`, `INITIALIZE-DOCUMENT-TYPE`, `INITIATE`, `INNER-CHARS`, `INNER-LINES`, `INPUT`, `INPUT-O`, `INPUT-OU`, `INPUT-OUT`, `INPUT-OUTP`, `INPUT-OUTPU`, `INPUT-OUTPUT`, `INPUT-VALUE`, `INSERT`, `INSERT-ATTRIBUTE`, `INSERT-B`, `INSERT-BA`, `INSERT-BAC`, `INSERT-BACK`, `INSERT-BACKT`, `INSERT-BACKTA`, `INSERT-BACKTAB`, `INSERT-FILE`, `INSERT-ROW`, `INSERT-STRING`, `INSERT-T`, `INSERT-TA`, `INSERT-TAB`, `INT64`, `INT`, `INTEGER`, `INTERFACE`, `INTERNAL-ENTRIES`, `INTO`, `INVOKE`, `IS`, `IS-ATTR`, `IS-ATTR-`, `IS-ATTR-S`, `IS-ATTR-SP`, `IS-ATTR-SPA`, `IS-ATTR-SPAC`, `IS-ATTR-SPACE`, `IS-CLASS`, `IS-JSON`, `IS-LEAD-BYTE`, `IS-OPEN`, `IS-PARAMETER-SET`, `IS-PARTITIONED`, `IS-ROW-SELECTED`, `IS-SELECTED`, `IS-XML`, `ITEM`, `ITEMS-PER-ROW`, `JOIN`, `JOIN-BY-SQLDB`, `KBLABEL`, `KEEP-CONNECTION-OPEN`, `KEEP-FRAME-Z`, `KEEP-FRAME-Z-`, `KEEP-FRAME-Z-O`, `KEEP-FRAME-Z-OR`, `KEEP-FRAME-Z-ORD`, `KEEP-FRAME-Z-ORDE`, `KEEP-FRAME-Z-ORDER`, `KEEP-MESSAGES`, `KEEP-SECURITY-CACHE`, `KEEP-TAB-ORDER`, `KEY`, `KEY-CODE`, `KEY-FUNC`, `KEY-FUNCT`, `KEY-FUNCTI`, `KEY-FUNCTIO`, `KEY-FUNCTION`, `KEY-LABEL`, `KEYCODE`, `KEYFUNC`, `KEYFUNCT`, `KEYFUNCTI`, `KEYFUNCTIO`, `KEYFUNCTION`, `KEYLABEL`, `KEYS`, `KEYWORD`, `KEYWORD-ALL`, `LABEL`, `LABEL-BGC`, `LABEL-BGCO`, `LABEL-BGCOL`, `LABEL-BGCOLO`, `LABEL-BGCOLOR`, `LABEL-DC`, `LABEL-DCO`, `LABEL-DCOL`, `LABEL-DCOLO`, `LABEL-DCOLOR`, `LABEL-FGC`, `LABEL-FGCO`, `LABEL-FGCOL`, `LABEL-FGCOLO`, `LABEL-FGCOLOR`, `LABEL-FONT`, `LABEL-PFC`, `LABEL-PFCO`, `LABEL-PFCOL`, `LABEL-PFCOLO`, `LABEL-PFCOLOR`, `LABELS`, `LABELS-HAVE-COLONS`, `LANDSCAPE`, `LANGUAGE`, `LANGUAGES`, `LARGE`, `LARGE-TO-SMALL`, `LAST`, `LAST-ASYNCH-REQUEST`, `LAST-BATCH`, `LAST-CHILD`, `LAST-EVEN`, `LAST-EVENT`, `LAST-FORM`, `LAST-KEY`, `LAST-OBJECT`, `LAST-OF`, `LAST-PROCE`, `LAST-PROCED`, `LAST-PROCEDU`, `LAST-PROCEDUR`, `LAST-PROCEDURE`, `LAST-SERVER`, `LAST-TAB-I`, `LAST-TAB-IT`, `LAST-TAB-ITE`, `LAST-TAB-ITEM`, `LASTKEY`, `LC`, `LDBNAME`, `LE`, `LEAVE`, `LEFT-ALIGN`, `LEFT-ALIGNE`, `LEFT-ALIGNED`, `LEFT-TRIM`, `LENGTH`, `LIBRARY`, `LIKE`, `LIKE-SEQUENTIAL`, `LINE`, `LINE-COUNT`, `LINE-COUNTE`, `LINE-COUNTER`, `LIST-EVENTS`, `LIST-ITEM-PAIRS`, `LIST-ITEMS`, `LIST-PROPERTY-NAMES`, `LIST-QUERY-ATTRS`, `LIST-SET-ATTRS`, `LIST-WIDGETS`, `LISTI`, `LISTIN`, `LISTING`, `LITERAL-QUESTION`, `LITTLE-ENDIAN`, `LOAD`, `LOAD-DOMAINS`, `LOAD-ICON`, `LOAD-IMAGE`, `LOAD-IMAGE-DOWN`, `LOAD-IMAGE-INSENSITIVE`, `LOAD-IMAGE-UP`, `LOAD-MOUSE-P`, `LOAD-MOUSE-PO`, `LOAD-MOUSE-POI`, `LOAD-MOUSE-POIN`, `LOAD-MOUSE-POINT`, `LOAD-MOUSE-POINTE`, `LOAD-MOUSE-POINTER`, `LOAD-PICTURE`, `LOAD-SMALL-ICON`, `LOCAL-NAME`, `LOCAL-VERSION-INFO`, `LOCATOR-COLUMN-NUMBER`, `LOCATOR-LINE-NUMBER`, `LOCATOR-PUBLIC-ID`, `LOCATOR-SYSTEM-ID`, `LOCATOR-TYPE`, `LOCK-REGISTRATION`, `LOCKED`, `LOG`, `LOG-AUDIT-EVENT`, `LOG-MANAGER`, `LOGICAL`, `LOGIN-EXPIRATION-TIMESTAMP`, `LOGIN-HOST`, `LOGIN-STATE`, `LOGOUT`, `LONGCHAR`, `LOOKAHEAD`, `LOOKUP`, `LT`, `MACHINE-CLASS`, `MANDATORY`, `MANUAL-HIGHLIGHT`, `MAP`, `MARGIN-EXTRA`, `MARGIN-HEIGHT`, `MARGIN-HEIGHT-`, `MARGIN-HEIGHT-C`, `MARGIN-HEIGHT-CH`, `MARGIN-HEIGHT-CHA`, `MARGIN-HEIGHT-CHAR`, `MARGIN-HEIGHT-CHARS`, `MARGIN-HEIGHT-P`, `MARGIN-HEIGHT-PI`, `MARGIN-HEIGHT-PIX`, `MARGIN-HEIGHT-PIXE`, `MARGIN-HEIGHT-PIXEL`, `MARGIN-HEIGHT-PIXELS`, `MARGIN-WIDTH`, `MARGIN-WIDTH-`, `MARGIN-WIDTH-C`, `MARGIN-WIDTH-CH`, `MARGIN-WIDTH-CHA`, `MARGIN-WIDTH-CHAR`, `MARGIN-WIDTH-CHARS`, `MARGIN-WIDTH-P`, `MARGIN-WIDTH-PI`, `MARGIN-WIDTH-PIX`, `MARGIN-WIDTH-PIXE`, `MARGIN-WIDTH-PIXEL`, `MARGIN-WIDTH-PIXELS`, `MARK-NEW`, `MARK-ROW-STATE`, `MATCHES`, `MAX`, `MAX-BUTTON`, `MAX-CHARS`, `MAX-DATA-GUESS`, `MAX-HEIGHT`, `MAX-HEIGHT-C`, `MAX-HEIGHT-CH`, `MAX-HEIGHT-CHA`, `MAX-HEIGHT-CHAR`, `MAX-HEIGHT-CHARS`, `MAX-HEIGHT-P`, `MAX-HEIGHT-PI`, `MAX-HEIGHT-PIX`, `MAX-HEIGHT-PIXE`, `MAX-HEIGHT-PIXEL`, `MAX-HEIGHT-PIXELS`, `MAX-ROWS`, `MAX-SIZE`, `MAX-VAL`, `MAX-VALU`, `MAX-VALUE`, `MAX-WIDTH`, `MAX-WIDTH-`, `MAX-WIDTH-C`, `MAX-WIDTH-CH`, `MAX-WIDTH-CHA`, `MAX-WIDTH-CHAR`, `MAX-WIDTH-CHARS`, `MAX-WIDTH-P`, `MAX-WIDTH-PI`, `MAX-WIDTH-PIX`, `MAX-WIDTH-PIXE`, `MAX-WIDTH-PIXEL`, `MAX-WIDTH-PIXELS`, `MAXI`, `MAXIM`, `MAXIMIZE`, `MAXIMU`, `MAXIMUM`, `MAXIMUM-LEVEL`, `MD5-DIGEST`, `MEMBER`, `MEMPTR-TO-NODE-VALUE`, `MENU`, `MENU-BAR`, `MENU-ITEM`, `MENU-K`, `MENU-KE`, `MENU-KEY`, `MENU-M`, `MENU-MO`, `MENU-MOU`, `MENU-MOUS`, `MENU-MOUSE`, `MENUBAR`, `MERGE-BY-FIELD`, `MESSAGE`, `MESSAGE-AREA`, `MESSAGE-AREA-FONT`, `MESSAGE-LINES`, `METHOD`, `MIN`, `MIN-BUTTON`, `MIN-COLUMN-WIDTH-C`, `MIN-COLUMN-WIDTH-CH`, `MIN-COLUMN-WIDTH-CHA`, `MIN-COLUMN-WIDTH-CHAR`, `MIN-COLUMN-WIDTH-CHARS`, `MIN-COLUMN-WIDTH-P`, `MIN-COLUMN-WIDTH-PI`, `MIN-COLUMN-WIDTH-PIX`, `MIN-COLUMN-WIDTH-PIXE`, `MIN-COLUMN-WIDTH-PIXEL`, `MIN-COLUMN-WIDTH-PIXELS`, `MIN-HEIGHT`, `MIN-HEIGHT-`, `MIN-HEIGHT-C`, `MIN-HEIGHT-CH`, `MIN-HEIGHT-CHA`, `MIN-HEIGHT-CHAR`, `MIN-HEIGHT-CHARS`, `MIN-HEIGHT-P`, `MIN-HEIGHT-PI`, `MIN-HEIGHT-PIX`, `MIN-HEIGHT-PIXE`, `MIN-HEIGHT-PIXEL`, `MIN-HEIGHT-PIXELS`, `MIN-SIZE`, `MIN-VAL`, `MIN-VALU`, `MIN-VALUE`, `MIN-WIDTH`, `MIN-WIDTH-`, `MIN-WIDTH-C`, `MIN-WIDTH-CH`, `MIN-WIDTH-CHA`, `MIN-WIDTH-CHAR`, `MIN-WIDTH-CHARS`, `MIN-WIDTH-P`, `MIN-WIDTH-PI`, `MIN-WIDTH-PIX`, `MIN-WIDTH-PIXE`, `MIN-WIDTH-PIXEL`, `MIN-WIDTH-PIXELS`, `MINI`, `MINIM`, `MINIMU`, `MINIMUM`, `MOD`, `MODIFIED`, `MODU`, `MODUL`, `MODULO`, `MONTH`, `MOUSE`, `MOUSE-P`, `MOUSE-PO`, `MOUSE-POI`, `MOUSE-POIN`, `MOUSE-POINT`, `MOUSE-POINTE`, `MOUSE-POINTER`, `MOVABLE`, `MOVE-AFTER`, `MOVE-AFTER-`, `MOVE-AFTER-T`, `MOVE-AFTER-TA`, `MOVE-AFTER-TAB`, `MOVE-AFTER-TAB-`, `MOVE-AFTER-TAB-I`, `MOVE-AFTER-TAB-IT`, `MOVE-AFTER-TAB-ITE`, `MOVE-AFTER-TAB-ITEM`, `MOVE-BEFOR`, `MOVE-BEFORE`, `MOVE-BEFORE-`, `MOVE-BEFORE-T`, `MOVE-BEFORE-TA`, `MOVE-BEFORE-TAB`, `MOVE-BEFORE-TAB-`, `MOVE-BEFORE-TAB-I`, `MOVE-BEFORE-TAB-IT`, `MOVE-BEFORE-TAB-ITE`, `MOVE-BEFORE-TAB-ITEM`, `MOVE-COL`, `MOVE-COLU`, `MOVE-COLUM`, `MOVE-COLUMN`, `MOVE-TO-B`, `MOVE-TO-BO`, `MOVE-TO-BOT`, `MOVE-TO-BOTT`, `MOVE-TO-BOTTO`, `MOVE-TO-BOTTOM`, `MOVE-TO-EOF`, `MOVE-TO-T`, `MOVE-TO-TO`, `MOVE-TO-TOP`, `MPE`, `MTIME`, `MULTI-COMPILE`, `MULTIPLE`, `MULTIPLE-KEY`, `MULTITASKING-INTERVAL`, `MUST-EXIST`, `NAME`, `NAMESPACE-PREFIX`, `NAMESPACE-URI`, `NATIVE`, `NE`, `NEEDS-APPSERVER-PROMPT`, `NEEDS-PROMPT`, `NEW`, `NEW-INSTANCE`, `NEW-ROW`, `NEXT`, `NEXT-COLUMN`, `NEXT-PROMPT`, `NEXT-ROWID`, `NEXT-SIBLING`, `NEXT-TAB-I`, `NEXT-TAB-IT`, `NEXT-TAB-ITE`, `NEXT-TAB-ITEM`, `NEXT-VALUE`, `NO`, `NO-APPLY`, `NO-ARRAY-MESSAGE`, `NO-ASSIGN`, `NO-ATTR`, `NO-ATTR-`, `NO-ATTR-L`, `NO-ATTR-LI`, `NO-ATTR-LIS`, `NO-ATTR-LIST`, `NO-ATTR-S`, `NO-ATTR-SP`, `NO-ATTR-SPA`, `NO-ATTR-SPAC`, `NO-ATTR-SPACE`, `NO-AUTO-VALIDATE`, `NO-BIND-WHERE`, `NO-BOX`, `NO-CONSOLE`, `NO-CONVERT`, `NO-CONVERT-3D-COLORS`, `NO-CURRENT-VALUE`, `NO-DEBUG`, `NO-DRAG`, `NO-ECHO`, `NO-EMPTY-SPACE`, `NO-ERROR`, `NO-F`, `NO-FI`, `NO-FIL`, `NO-FILL`, `NO-FOCUS`, `NO-HELP`, `NO-HIDE`, `NO-INDEX-HINT`, `NO-INHERIT-BGC`, `NO-INHERIT-BGCO`, `NO-INHERIT-BGCOLOR`, `NO-INHERIT-FGC`, `NO-INHERIT-FGCO`, `NO-INHERIT-FGCOL`, `NO-INHERIT-FGCOLO`, `NO-INHERIT-FGCOLOR`, `NO-JOIN-BY-SQLDB`, `NO-LABE`, `NO-LABELS`, `NO-LOBS`, `NO-LOCK`, `NO-LOOKAHEAD`, `NO-MAP`, `NO-MES`, `NO-MESS`, `NO-MESSA`, `NO-MESSAG`, `NO-MESSAGE`, `NO-PAUSE`, `NO-PREFE`, `NO-PREFET`, `NO-PREFETC`, `NO-PREFETCH`, `NO-ROW-MARKERS`, `NO-SCROLLBAR-VERTICAL`, `NO-SEPARATE-CONNECTION`, `NO-SEPARATORS`, `NO-TAB-STOP`, `NO-UND`, `NO-UNDE`, `NO-UNDER`, `NO-UNDERL`, `NO-UNDERLI`, `NO-UNDERLIN`, `NO-UNDERLINE`, `NO-UNDO`, `NO-VAL`, `NO-VALI`, `NO-VALID`, `NO-VALIDA`, `NO-VALIDAT`, `NO-VALIDATE`, `NO-WAIT`, `NO-WORD-WRAP`, `NODE-VALUE-TO-MEMPTR`, `NONAMESPACE-SCHEMA-LOCATION`, `NONE`, `NORMALIZE`, `NOT`, `NOT-ACTIVE`, `NOW`, `NULL`, `NUM-ALI`, `NUM-ALIA`, `NUM-ALIAS`, `NUM-ALIASE`, `NUM-ALIASES`, `NUM-BUFFERS`, `NUM-BUT`, `NUM-BUTT`, `NUM-BUTTO`, `NUM-BUTTON`, `NUM-BUTTONS`, `NUM-COL`, `NUM-COLU`, `NUM-COLUM`, `NUM-COLUMN`, `NUM-COLUMNS`, `NUM-COPIES`, `NUM-DBS`, `NUM-DROPPED-FILES`, `NUM-ENTRIES`, `NUM-FIELDS`, `NUM-FORMATS`, `NUM-ITEMS`, `NUM-ITERATIONS`, `NUM-LINES`, `NUM-LOCKED-COL`, `NUM-LOCKED-COLU`, `NUM-LOCKED-COLUM`, `NUM-LOCKED-COLUMN`, `NUM-LOCKED-COLUMNS`, `NUM-MESSAGES`, `NUM-PARAMETERS`, `NUM-REFERENCES`, `NUM-REPLACED`, `NUM-RESULTS`, `NUM-SELECTED`, `NUM-SELECTED-`, `NUM-SELECTED-ROWS`, `NUM-SELECTED-W`, `NUM-SELECTED-WI`, `NUM-SELECTED-WID`, `NUM-SELECTED-WIDG`, `NUM-SELECTED-WIDGE`, `NUM-SELECTED-WIDGET`, `NUM-SELECTED-WIDGETS`, `NUM-TABS`, `NUM-TO-RETAIN`, `NUM-VISIBLE-COLUMNS`, `NUMERIC`, `NUMERIC-F`, `NUMERIC-FO`, `NUMERIC-FOR`, `NUMERIC-FORM`, `NUMERIC-FORMA`, `NUMERIC-FORMAT`, `OCTET-LENGTH`, `OF`, `OFF`, `OK`, `OK-CANCEL`, `OLD`, `ON`, `ON-FRAME`, `ON-FRAME-`, `ON-FRAME-B`, `ON-FRAME-BO`, `ON-FRAME-BOR`, `ON-FRAME-BORD`, `ON-FRAME-BORDE`, `ON-FRAME-BORDER`, `OPEN`, `OPSYS`, `OPTION`, `OR`, `ORDERED-JOIN`, `ORDINAL`, `OS-APPEND`, `OS-COMMAND`, `OS-COPY`, `OS-CREATE-DIR`, `OS-DELETE`, `OS-DIR`, `OS-DRIVE`, `OS-DRIVES`, `OS-ERROR`, `OS-GETENV`, `OS-RENAME`, `OTHERWISE`, `OUTPUT`, `OVERLAY`, `OVERRIDE`, `OWNER`, `PAGE`, `PAGE-BOT`, `PAGE-BOTT`, `PAGE-BOTTO`, `PAGE-BOTTOM`, `PAGE-NUM`, `PAGE-NUMB`, `PAGE-NUMBE`, `PAGE-NUMBER`, `PAGE-SIZE`, `PAGE-TOP`, `PAGE-WID`, `PAGE-WIDT`, `PAGE-WIDTH`, `PAGED`, `PARAM`, `PARAME`, `PARAMET`, `PARAMETE`, `PARAMETER`, `PARENT`, `PARSE-STATUS`, `PARTIAL-KEY`, `PASCAL`, `PASSWORD-FIELD`, `PATHNAME`, `PAUSE`, `PBE-HASH-ALG`, `PBE-HASH-ALGO`, `PBE-HASH-ALGOR`, `PBE-HASH-ALGORI`, `PBE-HASH-ALGORIT`, `PBE-HASH-ALGORITH`, `PBE-HASH-ALGORITHM`, `PBE-KEY-ROUNDS`, `PDBNAME`, `PERSIST`, `PERSISTE`, `PERSISTEN`, `PERSISTENT`, `PERSISTENT-CACHE-DISABLED`, `PFC`, `PFCO`, `PFCOL`, `PFCOLO`, `PFCOLOR`, `PIXELS`, `PIXELS-PER-COL`, `PIXELS-PER-COLU`, `PIXELS-PER-COLUM`, `PIXELS-PER-COLUMN`, `PIXELS-PER-ROW`, `POPUP-M`, `POPUP-ME`, `POPUP-MEN`, `POPUP-MENU`, `POPUP-O`, `POPUP-ON`, `POPUP-ONL`, `POPUP-ONLY`, `PORTRAIT`, `POSITION`, `PRECISION`, `PREFER-DATASET`, `PREPARE-STRING`, `PREPARED`, `PREPROC`, `PREPROCE`, `PREPROCES`, `PREPROCESS`, `PRESEL`, `PRESELE`, `PRESELEC`, `PRESELECT`, `PREV`, `PREV-COLUMN`, `PREV-SIBLING`, `PREV-TAB-I`, `PREV-TAB-IT`, `PREV-TAB-ITE`, `PREV-TAB-ITEM`, `PRIMARY`, `PRINTER`, `PRINTER-CONTROL-HANDLE`, `PRINTER-HDC`, `PRINTER-NAME`, `PRINTER-PORT`, `PRINTER-SETUP`, `PRIVATE`, `PRIVATE-D`, `PRIVATE-DA`, `PRIVATE-DAT`, `PRIVATE-DATA`, `PRIVILEGES`, `PROC-HA`, `PROC-HAN`, `PROC-HAND`, `PROC-HANDL`, `PROC-HANDLE`, `PROC-ST`, `PROC-STA`, `PROC-STAT`, `PROC-STATU`, `PROC-STATUS`, `PROC-TEXT`, `PROC-TEXT-BUFFER`, `PROCE`, `PROCED`, `PROCEDU`, `PROCEDUR`, `PROCEDURE`, `PROCEDURE-CALL-TYPE`, `PROCEDURE-TYPE`, `PROCESS`, `PROFILER`, `PROGRAM-NAME`, `PROGRESS`, `PROGRESS-S`, `PROGRESS-SO`, `PROGRESS-SOU`, `PROGRESS-SOUR`, `PROGRESS-SOURC`, `PROGRESS-SOURCE`, `PROMPT`, `PROMPT-F`, `PROMPT-FO`, `PROMPT-FOR`, `PROMSGS`, `PROPATH`, `PROPERTY`, `PROTECTED`, `PROVERS`, `PROVERSI`, `PROVERSIO`, `PROVERSION`, `PROXY`, `PROXY-PASSWORD`, `PROXY-USERID`, `PUBLIC`, `PUBLIC-ID`, `PUBLISH`, `PUBLISHED-EVENTS`, `PUT`, `PUT-BYTE`, `PUT-DOUBLE`, `PUT-FLOAT`, `PUT-INT64`, `PUT-KEY-VAL`, `PUT-KEY-VALU`, `PUT-KEY-VALUE`, `PUT-LONG`, `PUT-SHORT`, `PUT-STRING`, `PUT-UNSIGNED-LONG`, `PUTBYTE`, `QUERY`, `QUERY-CLOSE`, `QUERY-OFF-END`, `QUERY-OPEN`, `QUERY-PREPARE`, `QUERY-TUNING`, `QUESTION`, `QUIT`, `QUOTER`, `R-INDEX`, `RADIO-BUTTONS`, `RADIO-SET`, `RANDOM`, `RAW`, `RAW-TRANSFER`, `RCODE-INFO`, `RCODE-INFOR`, `RCODE-INFORM`, `RCODE-INFORMA`, `RCODE-INFORMAT`, `RCODE-INFORMATI`, `RCODE-INFORMATIO`, `RCODE-INFORMATION`, `READ-AVAILABLE`, `READ-EXACT-NUM`, `READ-FILE`, `READ-JSON`, `READ-ONLY`, `READ-XML`, `READ-XMLSCHEMA`, `READKEY`, `REAL`, `RECID`, `RECORD-LENGTH`, `RECT`, `RECTA`, `RECTAN`, `RECTANG`, `RECTANGL`, `RECTANGLE`, `RECURSIVE`, `REFERENCE-ONLY`, `REFRESH`, `REFRESH-AUDIT-POLICY`, `REFRESHABLE`, `REGISTER-DOMAIN`, `RELEASE`, `REMOTE`, `REMOVE-EVENTS-PROCEDURE`, `REMOVE-SUPER-PROCEDURE`, `REPEAT`, `REPLACE`, `REPLACE-SELECTION-TEXT`, `REPOSITION`, `REPOSITION-BACKWARD`, `REPOSITION-FORWARD`, `REPOSITION-MODE`, `REPOSITION-TO-ROW`, `REPOSITION-TO-ROWID`, `REQUEST`, `REQUEST-INFO`, `RESET`, `RESIZA`, `RESIZAB`, `RESIZABL`, `RESIZABLE`, `RESIZE`, `RESPONSE-INFO`, `RESTART-ROW`, `RESTART-ROWID`, `RETAIN`, `RETAIN-SHAPE`, `RETRY`, `RETRY-CANCEL`, `RETURN`, `RETURN-ALIGN`, `RETURN-ALIGNE`, `RETURN-INS`, `RETURN-INSE`, `RETURN-INSER`, `RETURN-INSERT`, `RETURN-INSERTE`, `RETURN-INSERTED`, `RETURN-TO-START-DI`, `RETURN-TO-START-DIR`, `RETURN-VAL`, `RETURN-VALU`, `RETURN-VALUE`, `RETURN-VALUE-DATA-TYPE`, `RETURNS`, `REVERSE-FROM`, `REVERT`, `REVOKE`, `RGB-VALUE`, `RIGHT-ALIGNED`, `RIGHT-TRIM`, `ROLES`, `ROUND`, `ROUTINE-LEVEL`, `ROW`, `ROW-HEIGHT-CHARS`, `ROW-HEIGHT-PIXELS`, `ROW-MARKERS`, `ROW-OF`, `ROW-RESIZABLE`, `ROWID`, `RULE`, `RUN`, `RUN-PROCEDURE`, `SAVE CACHE`, `SAVE`, `SAVE-AS`, `SAVE-FILE`, `SAX-COMPLE`, `SAX-COMPLET`, `SAX-COMPLETE`, `SAX-PARSE`, `SAX-PARSE-FIRST`, `SAX-PARSE-NEXT`, `SAX-PARSER-ERROR`, `SAX-RUNNING`, `SAX-UNINITIALIZED`, `SAX-WRITE-BEGIN`, `SAX-WRITE-COMPLETE`, `SAX-WRITE-CONTENT`, `SAX-WRITE-ELEMENT`, `SAX-WRITE-ERROR`, `SAX-WRITE-IDLE`, `SAX-WRITE-TAG`, `SAX-WRITER`, `SCHEMA`, `SCHEMA-LOCATION`, `SCHEMA-MARSHAL`, `SCHEMA-PATH`, `SCREEN`, `SCREEN-IO`, `SCREEN-LINES`, `SCREEN-VAL`, `SCREEN-VALU`, `SCREEN-VALUE`, `SCROLL`, `SCROLL-BARS`, `SCROLL-DELTA`, `SCROLL-OFFSET`, `SCROLL-TO-CURRENT-ROW`, `SCROLL-TO-I`, `SCROLL-TO-IT`, `SCROLL-TO-ITE`, `SCROLL-TO-ITEM`, `SCROLL-TO-SELECTED-ROW`, `SCROLLABLE`, `SCROLLBAR-H`, `SCROLLBAR-HO`, `SCROLLBAR-HOR`, `SCROLLBAR-HORI`, `SCROLLBAR-HORIZ`, `SCROLLBAR-HORIZO`, `SCROLLBAR-HORIZON`, `SCROLLBAR-HORIZONT`, `SCROLLBAR-HORIZONTA`, `SCROLLBAR-HORIZONTAL`, `SCROLLBAR-V`, `SCROLLBAR-VE`, `SCROLLBAR-VER`, `SCROLLBAR-VERT`, `SCROLLBAR-VERTI`, `SCROLLBAR-VERTIC`, `SCROLLBAR-VERTICA`, `SCROLLBAR-VERTICAL`, `SCROLLED-ROW-POS`, `SCROLLED-ROW-POSI`, `SCROLLED-ROW-POSIT`, `SCROLLED-ROW-POSITI`, `SCROLLED-ROW-POSITIO`, `SCROLLED-ROW-POSITION`, `SCROLLING`, `SDBNAME`, `SEAL`, `SEAL-TIMESTAMP`, `SEARCH`, `SEARCH-SELF`, `SEARCH-TARGET`, `SECTION`, `SECURITY-POLICY`, `SEEK`, `SELECT`, `SELECT-ALL`, `SELECT-FOCUSED-ROW`, `SELECT-NEXT-ROW`, `SELECT-PREV-ROW`, `SELECT-ROW`, `SELECTABLE`, `SELECTED`, `SELECTION`, `SELECTION-END`, `SELECTION-LIST`, `SELECTION-START`, `SELECTION-TEXT`, `SELF`, `SEND`, `SEND-SQL-STATEMENT`, `SENSITIVE`, `SEPARATE-CONNECTION`, `SEPARATOR-FGCOLOR`, `SEPARATORS`, `SERIALIZABLE`, `SERIALIZE-HIDDEN`, `SERIALIZE-NAME`, `SERVER`, `SERVER-CONNECTION-BOUND`, `SERVER-CONNECTION-BOUND-REQUEST`, `SERVER-CONNECTION-CONTEXT`, `SERVER-CONNECTION-ID`, `SERVER-OPERATING-MODE`, `SESSION`, `SESSION-ID`, `SET`, `SET-APPL-CONTEXT`, `SET-ATTR-CALL-TYPE`, `SET-ATTRIBUTE-NODE`, `SET-BLUE`, `SET-BLUE-`, `SET-BLUE-V`, `SET-BLUE-VA`, `SET-BLUE-VAL`, `SET-BLUE-VALU`, `SET-BLUE-VALUE`, `SET-BREAK`, `SET-BUFFERS`, `SET-CALLBACK`, `SET-CLIENT`, `SET-COMMIT`, `SET-CONTENTS`, `SET-CURRENT-VALUE`, `SET-DB-CLIENT`, `SET-DYNAMIC`, `SET-EVENT-MANAGER-OPTION`, `SET-GREEN`, `SET-GREEN-`, `SET-GREEN-V`, `SET-GREEN-VA`, `SET-GREEN-VAL`, `SET-GREEN-VALU`, `SET-GREEN-VALUE`, `SET-INPUT-SOURCE`, `SET-OPTION`, `SET-OUTPUT-DESTINATION`, `SET-PARAMETER`, `SET-POINTER-VALUE`, `SET-PROPERTY`, `SET-RED`, `SET-RED-`, `SET-RED-V`, `SET-RED-VA`, `SET-RED-VAL`, `SET-RED-VALU`, `SET-RED-VALUE`, `SET-REPOSITIONED-ROW`, `SET-RGB-VALUE`, `SET-ROLLBACK`, `SET-SELECTION`, `SET-SIZE`, `SET-SORT-ARROW`, `SET-WAIT-STATE`, `SETUSER`, `SETUSERI`, `SETUSERID`, `SHA1-DIGEST`, `SHARE`, `SHARE-`, `SHARE-L`, `SHARE-LO`, `SHARE-LOC`, `SHARE-LOCK`, `SHARED`, `SHOW-IN-TASKBAR`, `SHOW-STAT`, `SHOW-STATS`, `SIDE-LAB`, `SIDE-LABE`, `SIDE-LABEL`, `SIDE-LABEL-H`, `SIDE-LABEL-HA`, `SIDE-LABEL-HAN`, `SIDE-LABEL-HAND`, `SIDE-LABEL-HANDL`, `SIDE-LABEL-HANDLE`, `SIDE-LABELS`, `SIGNATURE`, `SILENT`, `SIMPLE`, `SINGLE`, `SINGLE-RUN`, `SINGLETON`, `SIZE`, `SIZE-C`, `SIZE-CH`, `SIZE-CHA`, `SIZE-CHAR`, `SIZE-CHARS`, `SIZE-P`, `SIZE-PI`, `SIZE-PIX`, `SIZE-PIXE`, `SIZE-PIXEL`, `SIZE-PIXELS`, `SKIP`, `SKIP-DELETED-RECORD`, `SLIDER`, `SMALL-ICON`, `SMALL-TITLE`, `SMALLINT`, `SOME`, `SORT`, `SORT-ASCENDING`, `SORT-NUMBER`, `SOURCE`, `SOURCE-PROCEDURE`, `SPACE`, `SQL`, `SQRT`, `SSL-SERVER-NAME`, `STANDALONE`, `START`, `START-DOCUMENT`, `START-ELEMENT`, `START-MOVE`, `START-RESIZE`, `START-ROW-RESIZE`, `STATE-DETAIL`, `STATIC`, `STATUS`, `STATUS-AREA`, `STATUS-AREA-FONT`, `STDCALL`, `STOP`, `STOP-AFTER`, `STOP-PARSING`, `STOPPE`, `STOPPED`, `STORED-PROC`, `STORED-PROCE`, `STORED-PROCED`, `STORED-PROCEDU`, `STORED-PROCEDUR`, `STORED-PROCEDURE`, `STREAM`, `STREAM-HANDLE`, `STREAM-IO`, `STRETCH-TO-FIT`, `STRICT`, `STRICT-ENTITY-RESOLUTION`, `STRING`, `STRING-VALUE`, `STRING-XREF`, `SUB-AVE`, `SUB-AVER`, `SUB-AVERA`, `SUB-AVERAG`, `SUB-AVERAGE`, `SUB-COUNT`, `SUB-MAXIMUM`, `SUB-MENU`, `SUB-MIN`, `SUB-MINIMUM`, `SUB-TOTAL`, `SUBSCRIBE`, `SUBST`, `SUBSTI`, `SUBSTIT`, `SUBSTITU`, `SUBSTITUT`, `SUBSTITUTE`, `SUBSTR`, `SUBSTRI`, `SUBSTRIN`, `SUBSTRING`, `SUBTYPE`, `SUM`, `SUM-MAX`, `SUM-MAXI`, `SUM-MAXIM`, `SUM-MAXIMU`, `SUPER`, `SUPER-PROCEDURES`, `SUPPRESS-NAMESPACE-PROCESSING`, `SUPPRESS-W`, `SUPPRESS-WA`, `SUPPRESS-WAR`, `SUPPRESS-WARN`, `SUPPRESS-WARNI`, `SUPPRESS-WARNIN`, `SUPPRESS-WARNING`, `SUPPRESS-WARNINGS`, `SYMMETRIC-ENCRYPTION-ALGORITHM`, `SYMMETRIC-ENCRYPTION-IV`, `SYMMETRIC-ENCRYPTION-KEY`, `SYMMETRIC-SUPPORT`, `SYSTEM-ALERT`, `SYSTEM-ALERT-`, `SYSTEM-ALERT-B`, `SYSTEM-ALERT-BO`, `SYSTEM-ALERT-BOX`, `SYSTEM-ALERT-BOXE`, `SYSTEM-ALERT-BOXES`, `SYSTEM-DIALOG`, `SYSTEM-HELP`, `SYSTEM-ID`, `TAB-POSITION`, `TAB-STOP`, `TABLE`, `TABLE-HANDLE`, `TABLE-NUMBER`, `TABLE-SCAN`, `TARGET`, `TARGET-PROCEDURE`, `TEMP-DIR`, `TEMP-DIRE`, `TEMP-DIREC`, `TEMP-DIRECT`, `TEMP-DIRECTO`, `TEMP-DIRECTOR`, `TEMP-DIRECTORY`, `TEMP-TABLE`, `TEMP-TABLE-PREPARE`, `TERM`, `TERMI`, `TERMIN`, `TERMINA`, `TERMINAL`, `TERMINATE`, `TEXT`, `TEXT-CURSOR`, `TEXT-SEG-GROW`, `TEXT-SELECTED`, `THEN`, `THIS-OBJECT`, `THIS-PROCEDURE`, `THREAD-SAFE`, `THREE-D`, `THROUGH`, `THROW`, `THRU`, `TIC-MARKS`, `TIME`, `TIME-SOURCE`, `TITLE`, `TITLE-BGC`, `TITLE-BGCO`, `TITLE-BGCOL`, `TITLE-BGCOLO`, `TITLE-BGCOLOR`, `TITLE-DC`, `TITLE-DCO`, `TITLE-DCOL`, `TITLE-DCOLO`, `TITLE-DCOLOR`, `TITLE-FGC`, `TITLE-FGCO`, `TITLE-FGCOL`, `TITLE-FGCOLO`, `TITLE-FGCOLOR`, `TITLE-FO`, `TITLE-FON`, `TITLE-FONT`, `TO`, `TO-ROWID`, `TODAY`, `TOGGLE-BOX`, `TOOLTIP`, `TOOLTIPS`, `TOP-NAV-QUERY`, `TOP-ONLY`, `TOPIC`, `TOTAL`, `TRAILING`, `TRANS`, `TRANS-INIT-PROCEDURE`, `TRANSACTION`, `TRANSACTION-MODE`, `TRANSPARENT`, `TRIGGER`, `TRIGGERS`, `TRIM`, `TRUE`, `TRUNC`, `TRUNCA`, `TRUNCAT`, `TRUNCATE`, `TYPE`, `TYPE-OF`, `UNBOX`, `UNBUFF`, `UNBUFFE`, `UNBUFFER`, `UNBUFFERE`, `UNBUFFERED`, `UNDERL`, `UNDERLI`, `UNDERLIN`, `UNDERLINE`, `UNDO`, `UNFORM`, `UNFORMA`, `UNFORMAT`, `UNFORMATT`, `UNFORMATTE`, `UNFORMATTED`, `UNION`, `UNIQUE`, `UNIQUE-ID`, `UNIQUE-MATCH`, `UNIX`, `UNLESS-HIDDEN`, `UNLOAD`, `UNSIGNED-LONG`, `UNSUBSCRIBE`, `UP`, `UPDATE`, `UPDATE-ATTRIBUTE`, `URL`, `URL-DECODE`, `URL-ENCODE`, `URL-PASSWORD`, `URL-USERID`, `USE`, `USE-DICT-EXPS`, `USE-FILENAME`, `USE-INDEX`, `USE-REVVIDEO`, `USE-TEXT`, `USE-UNDERLINE`, `USE-WIDGET-POOL`, `USER`, `USER-ID`, `USERID`, `USING`, `V6DISPLAY`, `V6FRAME`, `VALID-EVENT`, `VALID-HANDLE`, `VALID-OBJECT`, `VALIDATE`, `VALIDATE-EXPRESSION`, `VALIDATE-MESSAGE`, `VALIDATE-SEAL`, `VALIDATION-ENABLED`, `VALUE`, `VALUE-CHANGED`, `VALUES`, `VAR`, `VARI`, `VARIA`, `VARIAB`, `VARIABL`, `VARIABLE`, `VERBOSE`, `VERSION`, `VERT`, `VERTI`, `VERTIC`, `VERTICA`, `VERTICAL`, `VIEW`, `VIEW-AS`, `VIEW-FIRST-COLUMN-ON-REOPEN`, `VIRTUAL-HEIGHT`, `VIRTUAL-HEIGHT-`, `VIRTUAL-HEIGHT-C`, `VIRTUAL-HEIGHT-CH`, `VIRTUAL-HEIGHT-CHA`, `VIRTUAL-HEIGHT-CHAR`, `VIRTUAL-HEIGHT-CHARS`, `VIRTUAL-HEIGHT-P`, `VIRTUAL-HEIGHT-PI`, `VIRTUAL-HEIGHT-PIX`, `VIRTUAL-HEIGHT-PIXE`, `VIRTUAL-HEIGHT-PIXEL`, `VIRTUAL-HEIGHT-PIXELS`, `VIRTUAL-WIDTH`, `VIRTUAL-WIDTH-`, `VIRTUAL-WIDTH-C`, `VIRTUAL-WIDTH-CH`, `VIRTUAL-WIDTH-CHA`, `VIRTUAL-WIDTH-CHAR`, `VIRTUAL-WIDTH-CHARS`, `VIRTUAL-WIDTH-P`, `VIRTUAL-WIDTH-PI`, `VIRTUAL-WIDTH-PIX`, `VIRTUAL-WIDTH-PIXE`, `VIRTUAL-WIDTH-PIXEL`, `VIRTUAL-WIDTH-PIXELS`, `VISIBLE`, `VOID`, `WAIT`, `WAIT-FOR`, `WARNING`, `WEB-CONTEXT`, `WEEKDAY`, `WHEN`, `WHERE`, `WHILE`, `WIDGET`, `WIDGET-E`, `WIDGET-EN`, `WIDGET-ENT`, `WIDGET-ENTE`, `WIDGET-ENTER`, `WIDGET-ID`, `WIDGET-L`, `WIDGET-LE`, `WIDGET-LEA`, `WIDGET-LEAV`, `WIDGET-LEAVE`, `WIDGET-POOL`, `WIDTH`, `WIDTH-`, `WIDTH-C`, `WIDTH-CH`, `WIDTH-CHA`, `WIDTH-CHAR`, `WIDTH-CHARS`, `WIDTH-P`, `WIDTH-PI`, `WIDTH-PIX`, `WIDTH-PIXE`, `WIDTH-PIXEL`, `WIDTH-PIXELS`, `WINDOW`, `WINDOW-MAXIM`, `WINDOW-MAXIMI`, `WINDOW-MAXIMIZ`, `WINDOW-MAXIMIZE`, `WINDOW-MAXIMIZED`, `WINDOW-MINIM`, `WINDOW-MINIMI`, `WINDOW-MINIMIZ`, `WINDOW-MINIMIZE`, `WINDOW-MINIMIZED`, `WINDOW-NAME`, `WINDOW-NORMAL`, `WINDOW-STA`, `WINDOW-STAT`, `WINDOW-STATE`, `WINDOW-SYSTEM`, `WITH`, `WORD-INDEX`, `WORD-WRAP`, `WORK-AREA-HEIGHT-PIXELS`, `WORK-AREA-WIDTH-PIXELS`, `WORK-AREA-X`, `WORK-AREA-Y`, `WORK-TAB`, `WORK-TABL`, `WORK-TABLE`, `WORKFILE`, `WRITE`, `WRITE-CDATA`, `WRITE-CHARACTERS`, `WRITE-COMMENT`, `WRITE-DATA-ELEMENT`, `WRITE-EMPTY-ELEMENT`, `WRITE-ENTITY-REF`, `WRITE-EXTERNAL-DTD`, `WRITE-FRAGMENT`, `WRITE-JSON`, `WRITE-MESSAGE`, `WRITE-PROCESSING-INSTRUCTION`, `WRITE-STATUS`, `WRITE-XML`, `WRITE-XMLSCHEMA`, `X`, `X-OF`, `XCODE`, `XML-DATA-TYPE`, `XML-ENTITY-EXPANSION-LIMIT`, `XML-NODE-TYPE`, `XML-SCHEMA-PATH`, `XML-STRICT-ENTITY-RESOLUTION`, `XML-SUPPRESS-NAMESPACE-PROCESSING`, `XREF`, `XREF-XML`, `Y`, `Y-OF`, `YEAR`, `YEAR-OFFSET`, `YES`, `YES-NO`, `YES-NO-CANCEL`), KeywordReserved, nil}, //nolint + {`"(\\\\|\\[^\\]|[^"\\])*"`, LiteralStringDouble, nil}, + {`'(\\\\|\\[^\\]|[^'\\])*'`, LiteralStringSingle, nil}, + {`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil}, + {`[0-9]+`, LiteralNumberInteger, nil}, + {`\s+`, Text, nil}, + {`[+*/=-]`, Operator, nil}, + {`[.:()]`, Punctuation, nil}, + {`.`, NameVariable, nil}, + }, + "comment": { + {`[^*/]`, CommentMultiline, nil}, + {`/\*`, CommentMultiline, Push()}, + {`\*/`, CommentMultiline, Pop(1)}, + {`[*/]`, CommentMultiline, nil}, + {`\/\/`, CommentSingle, nil}, + }, + "preprocessor": { + {`[^{}]`, CommentPreproc, nil}, + {`\{`, CommentPreproc, Push()}, + {`\}`, CommentPreproc, Pop(1)}, + }, + } + }, +)) diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/p/plutus_core.go b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plutus_core.go new file mode 100644 index 00000000..b2ad4e10 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/p/plutus_core.go @@ -0,0 +1,76 @@ +package p + +import ( + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// nolint + +// Lexer for the Plutus Core Languages (version 2.1) +// +// including both Typed- and Untyped- versions +// based on “Formal Specification of the Plutus Core Language (version 2.1)”, published 6th April 2021: +// https://hydra.iohk.io/build/8205579/download/1/plutus-core-specification.pdf + +var PlutusCoreLang = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Plutus Core", + Aliases: []string{"plutus-core", "plc"}, + Filenames: []string{"*.plc"}, + MimeTypes: []string{"text/x-plutus-core", "application/x-plutus-core"}, + }, + plutusCoreRules, +)) + +func plutusCoreRules() Rules { + return Rules{ + "root": { + {`\s+`, Text, nil}, + {`(\(|\))`, Punctuation, nil}, + {`(\[|\])`, Punctuation, nil}, + {`({|})`, Punctuation, nil}, + + // Constants. Figure 1. + // For version, see handling of (program ...) below. + {`([+-]?\d+)`, LiteralNumberInteger, nil}, + {`(#([a-fA-F0-9][a-fA-F0-9])+)`, LiteralString, nil}, + {`(\(\))`, NameConstant, nil}, + {`(True|False)`, NameConstant, nil}, + + // Keywords. Figures 2 and 15. + // Special handling for program because it is followed by a version. + {`(con |abs |iwrap |unwrap |lam |builtin |delay |force |error)`, Keyword, nil}, + {`(fun |all |ifix |lam |con )`, Keyword, nil}, + {`(type|fun )`, Keyword, nil}, + {`(program )(\S+)`, ByGroups(Keyword, LiteralString), nil}, + + // Built-in Types. Figure 12. + {`(unit|bool|integer|bytestring|string)`, KeywordType, nil}, + + // Built-ins Functions. Figure 14 but, more importantly, implementation: + // https://github.com/input-output-hk/plutus/blob/6d759c4/plutus-core/plutus-core/src/PlutusCore/Default/Builtins.hs#L42-L111 + {`(addInteger |subtractInteger |multiplyInteger |divideInteger |quotientInteger |remainderInteger |modInteger |equalsInteger |lessThanInteger |lessThanEqualsInteger )`, NameBuiltin, nil}, + {`(appendByteString |consByteString |sliceByteString |lengthOfByteString |indexByteString |equalsByteString |lessThanByteString |lessThanEqualsByteString )`, NameBuiltin, nil}, + {`(sha2_256 |sha3_256 |blake2b_256 |verifySignature )`, NameBuiltin, nil}, + {`(appendString |equalsString |encodeUtf8 |decodeUtf8 )`, NameBuiltin, nil}, + {`(ifThenElse )`, NameBuiltin, nil}, + {`(chooseUnit )`, NameBuiltin, nil}, + {`(trace )`, NameBuiltin, nil}, + {`(fstPair |sndPair )`, NameBuiltin, nil}, + {`(chooseList |mkCons |headList |tailList |nullList )`, NameBuiltin, nil}, + {`(chooseData |constrData |mapData |listData |iData |bData |unConstrData |unMapData |unListData |unIData |unBData |equalsData )`, NameBuiltin, nil}, + {`(mkPairData |mkNilData |mkNilPairData )`, NameBuiltin, nil}, + + // Name. Figure 1. + {`([a-zA-Z][a-zA-Z0-9_']*)`, Name, nil}, + + // Unicode String. Not in the specification. + {`"`, LiteralStringDouble, Push("string")}, + }, + "string": { + {`[^\\"]+`, LiteralStringDouble, nil}, + {`"`, LiteralStringDouble, Pop(1)}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go index d2f177ea..72a99f60 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/s/scheme.go @@ -30,7 +30,7 @@ func schemeLangRules() Rules { {`-?\d+`, LiteralNumberInteger, nil}, {`"(\\\\|\\"|[^"])*"`, LiteralString, nil}, {`'[\w!$%&*+,/:<=>?@^~|-]+`, LiteralStringSymbol, nil}, - {`#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)`, LiteralStringChar, nil}, + {`#\\(alarm|backspace|delete|esc|linefeed|newline|page|return|space|tab|vtab|x[0-9a-zA-Z]{1,5}|.)`, LiteralStringChar, nil}, {`(#t|#f)`, NameConstant, nil}, {"('|#|`|,@|,|\\.)", Operator, nil}, {`(lambda |define |if |else |cond |and |or |case |let |let\* |letrec |begin |do |delay |set\! |\=\> |quote |quasiquote |unquote |unquote\-splicing |define\-syntax |let\-syntax |letrec\-syntax |syntax\-rules )`, Keyword, nil}, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/x/xml.go b/backend/vendor/github.com/alecthomas/chroma/lexers/x/xml.go index 1e93c4ee..b98e9a4b 100644 --- a/backend/vendor/github.com/alecthomas/chroma/lexers/x/xml.go +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/x/xml.go @@ -10,7 +10,7 @@ var XML = internal.Register(MustNewLazyLexer( &Config{ Name: "XML", Aliases: []string{"xml"}, - Filenames: []string{"*.xml", "*.xsl", "*.rss", "*.xslt", "*.xsd", "*.wsdl", "*.wsf", "*.svg"}, + Filenames: []string{"*.xml", "*.xsl", "*.rss", "*.xslt", "*.xsd", "*.wsdl", "*.wsf", "*.svg", "*.csproj", "*.vcxproj", "*.fsproj"}, MimeTypes: []string{"text/xml", "application/xml", "image/svg+xml", "application/rss+xml", "application/atom+xml"}, DotAll: true, }, diff --git a/backend/vendor/github.com/alecthomas/chroma/lexers/z/zed.go b/backend/vendor/github.com/alecthomas/chroma/lexers/z/zed.go new file mode 100644 index 00000000..5479a2ce --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/lexers/z/zed.go @@ -0,0 +1,53 @@ +package z + +import ( + "strings" + + . "github.com/alecthomas/chroma" // nolint + "github.com/alecthomas/chroma/lexers/internal" +) + +// Zed lexer. +var Zed = internal.Register(MustNewLazyLexer( + &Config{ + Name: "Zed", + Aliases: []string{"zed"}, + Filenames: []string{"*.zed"}, + MimeTypes: []string{"text/zed"}, + }, + zedRules, +).SetAnalyser(func(text string) float32 { + if strings.Contains(text, "definition ") && strings.Contains(text, "relation ") && strings.Contains(text, "permission ") { + return 0.9 + } + if strings.Contains(text, "definition ") { + return 0.5 + } + if strings.Contains(text, "relation ") { + return 0.5 + } + if strings.Contains(text, "permission ") { + return 0.25 + } + return 0.0 +})) + +func zedRules() Rules { + return Rules{ + "root": { + {`\n`, TextWhitespace, nil}, + {`\s+`, TextWhitespace, nil}, + {`//.*?\n`, CommentSingle, nil}, + {`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil}, + {`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil}, + {Words(``, `\b`, `definition`), KeywordType, nil}, + {Words(``, `\b`, `relation`), KeywordNamespace, nil}, + {Words(``, `\b`, `permission`), KeywordDeclaration, nil}, + {`[a-zA-Z_]\w*/`, NameNamespace, nil}, + {`[a-zA-Z_]\w*`, Name, nil}, + {`#[a-zA-Z_]\w*`, NameVariable, nil}, + {`[+%=><|^!?/\-*&~:]`, Operator, nil}, + {`[{}()\[\],.;]`, Punctuation, nil}, + }, + } +} diff --git a/backend/vendor/github.com/alecthomas/chroma/styles/witchhazel.go b/backend/vendor/github.com/alecthomas/chroma/styles/witchhazel.go new file mode 100644 index 00000000..4aea2788 --- /dev/null +++ b/backend/vendor/github.com/alecthomas/chroma/styles/witchhazel.go @@ -0,0 +1,52 @@ +// Copyright 2018 Alethea Katherine Flowers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package styles + +import ( + "github.com/alecthomas/chroma" +) + +// WitchHazel Style +var WitchHazel = Register(chroma.MustNewStyle("witchhazel", chroma.StyleEntries{ + chroma.Text: "#F8F8F2", + chroma.Whitespace: "#A8757B", + chroma.Error: "#960050 bg:#1e0010", + chroma.Comment: "#b0bec5", + chroma.Keyword: "#C2FFDF", + chroma.KeywordNamespace: "#FFB8D1", + chroma.Operator: "#FFB8D1", + chroma.Punctuation: "#F8F8F2", + chroma.Name: "#F8F8F2", + chroma.NameAttribute: "#ceb1ff", + chroma.NameBuiltinPseudo: "#80cbc4", + chroma.NameClass: "#ceb1ff", + chroma.NameConstant: "#C5A3FF", + chroma.NameDecorator: "#ceb1ff", + chroma.NameException: "#ceb1ff", + chroma.NameFunction: "#ceb1ff", + chroma.NameProperty: "#F8F8F2", + chroma.NameTag: "#FFB8D1", + chroma.NameVariable: "#F8F8F2", + chroma.Number: "#C5A3FF", + chroma.Literal: "#ae81ff", + chroma.LiteralDate: "#e6db74", + chroma.String: "#1bc5e0", + chroma.GenericDeleted: "#f92672", + chroma.GenericEmph: "italic", + chroma.GenericInserted: "#a6e22e", + chroma.GenericStrong: "bold", + chroma.GenericSubheading: "#75715e", + chroma.Background: " bg:#433e56", +})) diff --git a/backend/vendor/github.com/alecthomas/chroma/styles/xcode-dark.go b/backend/vendor/github.com/alecthomas/chroma/styles/xcode-dark.go index a16d946f..9a9d7579 100644 --- a/backend/vendor/github.com/alecthomas/chroma/styles/xcode-dark.go +++ b/backend/vendor/github.com/alecthomas/chroma/styles/xcode-dark.go @@ -21,7 +21,7 @@ var ( // Xcode dark style var XcodeDark = Register(chroma.MustNewStyle("xcode-dark", chroma.StyleEntries{ - chroma.Background: plainText + " bg: " + background, + chroma.Background: plainText + " bg:" + background, chroma.Comment: comments, chroma.CommentMultiline: comments, diff --git a/backend/vendor/github.com/alecthomas/chroma/tokentype_string.go b/backend/vendor/github.com/alecthomas/chroma/tokentype_string.go index 6fe38674..9c302f9c 100644 --- a/backend/vendor/github.com/alecthomas/chroma/tokentype_string.go +++ b/backend/vendor/github.com/alecthomas/chroma/tokentype_string.go @@ -9,14 +9,17 @@ func _() { // Re-run the stringer command to generate them again. var x [1]struct{} _ = x[Background - -1] - _ = x[LineNumbers - -2] - _ = x[LineNumbersTable - -3] - _ = x[LineHighlight - -4] - _ = x[LineTable - -5] - _ = x[LineTableTD - -6] - _ = x[Error - -7] - _ = x[Other - -8] - _ = x[None - -9] + _ = x[PreWrapper - -2] + _ = x[Line - -3] + _ = x[LineNumbers - -4] + _ = x[LineNumbersTable - -5] + _ = x[LineHighlight - -6] + _ = x[LineTable - -7] + _ = x[LineTableTD - -8] + _ = x[CodeLine - -9] + _ = x[Error - -10] + _ = x[Other - -11] + _ = x[None - -12] _ = x[EOFType-0] _ = x[Keyword-1000] _ = x[KeywordConstant-1001] @@ -105,104 +108,107 @@ func _() { _ = x[TextPunctuation-8003] } -const _TokenType_name = "NoneOtherErrorLineTableTDLineTableLineHighlightLineNumbersTableLineNumbersBackgroundEOFTypeKeywordKeywordConstantKeywordDeclarationKeywordNamespaceKeywordPseudoKeywordReservedKeywordTypeNameNameAttributeNameBuiltinNameBuiltinPseudoNameClassNameConstantNameDecoratorNameEntityNameExceptionNameFunctionNameFunctionMagicNameKeywordNameLabelNameNamespaceNameOperatorNameOtherNamePseudoNamePropertyNameTagNameVariableNameVariableAnonymousNameVariableClassNameVariableGlobalNameVariableInstanceNameVariableMagicLiteralLiteralDateLiteralOtherLiteralStringLiteralStringAffixLiteralStringAtomLiteralStringBacktickLiteralStringBooleanLiteralStringCharLiteralStringDelimiterLiteralStringDocLiteralStringDoubleLiteralStringEscapeLiteralStringHeredocLiteralStringInterpolLiteralStringNameLiteralStringOtherLiteralStringRegexLiteralStringSingleLiteralStringSymbolLiteralNumberLiteralNumberBinLiteralNumberFloatLiteralNumberHexLiteralNumberIntegerLiteralNumberIntegerLongLiteralNumberOctOperatorOperatorWordPunctuationCommentCommentHashbangCommentMultilineCommentSingleCommentSpecialCommentPreprocCommentPreprocFileGenericGenericDeletedGenericEmphGenericErrorGenericHeadingGenericInsertedGenericOutputGenericPromptGenericStrongGenericSubheadingGenericTracebackGenericUnderlineTextTextWhitespaceTextSymbolTextPunctuation" +const _TokenType_name = "NoneOtherErrorCodeLineLineTableTDLineTableLineHighlightLineNumbersTableLineNumbersLinePreWrapperBackgroundEOFTypeKeywordKeywordConstantKeywordDeclarationKeywordNamespaceKeywordPseudoKeywordReservedKeywordTypeNameNameAttributeNameBuiltinNameBuiltinPseudoNameClassNameConstantNameDecoratorNameEntityNameExceptionNameFunctionNameFunctionMagicNameKeywordNameLabelNameNamespaceNameOperatorNameOtherNamePseudoNamePropertyNameTagNameVariableNameVariableAnonymousNameVariableClassNameVariableGlobalNameVariableInstanceNameVariableMagicLiteralLiteralDateLiteralOtherLiteralStringLiteralStringAffixLiteralStringAtomLiteralStringBacktickLiteralStringBooleanLiteralStringCharLiteralStringDelimiterLiteralStringDocLiteralStringDoubleLiteralStringEscapeLiteralStringHeredocLiteralStringInterpolLiteralStringNameLiteralStringOtherLiteralStringRegexLiteralStringSingleLiteralStringSymbolLiteralNumberLiteralNumberBinLiteralNumberFloatLiteralNumberHexLiteralNumberIntegerLiteralNumberIntegerLongLiteralNumberOctOperatorOperatorWordPunctuationCommentCommentHashbangCommentMultilineCommentSingleCommentSpecialCommentPreprocCommentPreprocFileGenericGenericDeletedGenericEmphGenericErrorGenericHeadingGenericInsertedGenericOutputGenericPromptGenericStrongGenericSubheadingGenericTracebackGenericUnderlineTextTextWhitespaceTextSymbolTextPunctuation" var _TokenType_map = map[TokenType]string{ - -9: _TokenType_name[0:4], - -8: _TokenType_name[4:9], - -7: _TokenType_name[9:14], - -6: _TokenType_name[14:25], - -5: _TokenType_name[25:34], - -4: _TokenType_name[34:47], - -3: _TokenType_name[47:63], - -2: _TokenType_name[63:74], - -1: _TokenType_name[74:84], - 0: _TokenType_name[84:91], - 1000: _TokenType_name[91:98], - 1001: _TokenType_name[98:113], - 1002: _TokenType_name[113:131], - 1003: _TokenType_name[131:147], - 1004: _TokenType_name[147:160], - 1005: _TokenType_name[160:175], - 1006: _TokenType_name[175:186], - 2000: _TokenType_name[186:190], - 2001: _TokenType_name[190:203], - 2002: _TokenType_name[203:214], - 2003: _TokenType_name[214:231], - 2004: _TokenType_name[231:240], - 2005: _TokenType_name[240:252], - 2006: _TokenType_name[252:265], - 2007: _TokenType_name[265:275], - 2008: _TokenType_name[275:288], - 2009: _TokenType_name[288:300], - 2010: _TokenType_name[300:317], - 2011: _TokenType_name[317:328], - 2012: _TokenType_name[328:337], - 2013: _TokenType_name[337:350], - 2014: _TokenType_name[350:362], - 2015: _TokenType_name[362:371], - 2016: _TokenType_name[371:381], - 2017: _TokenType_name[381:393], - 2018: _TokenType_name[393:400], - 2019: _TokenType_name[400:412], - 2020: _TokenType_name[412:433], - 2021: _TokenType_name[433:450], - 2022: _TokenType_name[450:468], - 2023: _TokenType_name[468:488], - 2024: _TokenType_name[488:505], - 3000: _TokenType_name[505:512], - 3001: _TokenType_name[512:523], - 3002: _TokenType_name[523:535], - 3100: _TokenType_name[535:548], - 3101: _TokenType_name[548:566], - 3102: _TokenType_name[566:583], - 3103: _TokenType_name[583:604], - 3104: _TokenType_name[604:624], - 3105: _TokenType_name[624:641], - 3106: _TokenType_name[641:663], - 3107: _TokenType_name[663:679], - 3108: _TokenType_name[679:698], - 3109: _TokenType_name[698:717], - 3110: _TokenType_name[717:737], - 3111: _TokenType_name[737:758], - 3112: _TokenType_name[758:775], - 3113: _TokenType_name[775:793], - 3114: _TokenType_name[793:811], - 3115: _TokenType_name[811:830], - 3116: _TokenType_name[830:849], - 3200: _TokenType_name[849:862], - 3201: _TokenType_name[862:878], - 3202: _TokenType_name[878:896], - 3203: _TokenType_name[896:912], - 3204: _TokenType_name[912:932], - 3205: _TokenType_name[932:956], - 3206: _TokenType_name[956:972], - 4000: _TokenType_name[972:980], - 4001: _TokenType_name[980:992], - 5000: _TokenType_name[992:1003], - 6000: _TokenType_name[1003:1010], - 6001: _TokenType_name[1010:1025], - 6002: _TokenType_name[1025:1041], - 6003: _TokenType_name[1041:1054], - 6004: _TokenType_name[1054:1068], - 6100: _TokenType_name[1068:1082], - 6101: _TokenType_name[1082:1100], - 7000: _TokenType_name[1100:1107], - 7001: _TokenType_name[1107:1121], - 7002: _TokenType_name[1121:1132], - 7003: _TokenType_name[1132:1144], - 7004: _TokenType_name[1144:1158], - 7005: _TokenType_name[1158:1173], - 7006: _TokenType_name[1173:1186], - 7007: _TokenType_name[1186:1199], - 7008: _TokenType_name[1199:1212], - 7009: _TokenType_name[1212:1229], - 7010: _TokenType_name[1229:1245], - 7011: _TokenType_name[1245:1261], - 8000: _TokenType_name[1261:1265], - 8001: _TokenType_name[1265:1279], - 8002: _TokenType_name[1279:1289], - 8003: _TokenType_name[1289:1304], + -12: _TokenType_name[0:4], + -11: _TokenType_name[4:9], + -10: _TokenType_name[9:14], + -9: _TokenType_name[14:22], + -8: _TokenType_name[22:33], + -7: _TokenType_name[33:42], + -6: _TokenType_name[42:55], + -5: _TokenType_name[55:71], + -4: _TokenType_name[71:82], + -3: _TokenType_name[82:86], + -2: _TokenType_name[86:96], + -1: _TokenType_name[96:106], + 0: _TokenType_name[106:113], + 1000: _TokenType_name[113:120], + 1001: _TokenType_name[120:135], + 1002: _TokenType_name[135:153], + 1003: _TokenType_name[153:169], + 1004: _TokenType_name[169:182], + 1005: _TokenType_name[182:197], + 1006: _TokenType_name[197:208], + 2000: _TokenType_name[208:212], + 2001: _TokenType_name[212:225], + 2002: _TokenType_name[225:236], + 2003: _TokenType_name[236:253], + 2004: _TokenType_name[253:262], + 2005: _TokenType_name[262:274], + 2006: _TokenType_name[274:287], + 2007: _TokenType_name[287:297], + 2008: _TokenType_name[297:310], + 2009: _TokenType_name[310:322], + 2010: _TokenType_name[322:339], + 2011: _TokenType_name[339:350], + 2012: _TokenType_name[350:359], + 2013: _TokenType_name[359:372], + 2014: _TokenType_name[372:384], + 2015: _TokenType_name[384:393], + 2016: _TokenType_name[393:403], + 2017: _TokenType_name[403:415], + 2018: _TokenType_name[415:422], + 2019: _TokenType_name[422:434], + 2020: _TokenType_name[434:455], + 2021: _TokenType_name[455:472], + 2022: _TokenType_name[472:490], + 2023: _TokenType_name[490:510], + 2024: _TokenType_name[510:527], + 3000: _TokenType_name[527:534], + 3001: _TokenType_name[534:545], + 3002: _TokenType_name[545:557], + 3100: _TokenType_name[557:570], + 3101: _TokenType_name[570:588], + 3102: _TokenType_name[588:605], + 3103: _TokenType_name[605:626], + 3104: _TokenType_name[626:646], + 3105: _TokenType_name[646:663], + 3106: _TokenType_name[663:685], + 3107: _TokenType_name[685:701], + 3108: _TokenType_name[701:720], + 3109: _TokenType_name[720:739], + 3110: _TokenType_name[739:759], + 3111: _TokenType_name[759:780], + 3112: _TokenType_name[780:797], + 3113: _TokenType_name[797:815], + 3114: _TokenType_name[815:833], + 3115: _TokenType_name[833:852], + 3116: _TokenType_name[852:871], + 3200: _TokenType_name[871:884], + 3201: _TokenType_name[884:900], + 3202: _TokenType_name[900:918], + 3203: _TokenType_name[918:934], + 3204: _TokenType_name[934:954], + 3205: _TokenType_name[954:978], + 3206: _TokenType_name[978:994], + 4000: _TokenType_name[994:1002], + 4001: _TokenType_name[1002:1014], + 5000: _TokenType_name[1014:1025], + 6000: _TokenType_name[1025:1032], + 6001: _TokenType_name[1032:1047], + 6002: _TokenType_name[1047:1063], + 6003: _TokenType_name[1063:1076], + 6004: _TokenType_name[1076:1090], + 6100: _TokenType_name[1090:1104], + 6101: _TokenType_name[1104:1122], + 7000: _TokenType_name[1122:1129], + 7001: _TokenType_name[1129:1143], + 7002: _TokenType_name[1143:1154], + 7003: _TokenType_name[1154:1166], + 7004: _TokenType_name[1166:1180], + 7005: _TokenType_name[1180:1195], + 7006: _TokenType_name[1195:1208], + 7007: _TokenType_name[1208:1221], + 7008: _TokenType_name[1221:1234], + 7009: _TokenType_name[1234:1251], + 7010: _TokenType_name[1251:1267], + 7011: _TokenType_name[1267:1283], + 8000: _TokenType_name[1283:1287], + 8001: _TokenType_name[1287:1301], + 8002: _TokenType_name[1301:1311], + 8003: _TokenType_name[1311:1326], } func (i TokenType) String() string { diff --git a/backend/vendor/github.com/alecthomas/chroma/types.go b/backend/vendor/github.com/alecthomas/chroma/types.go index ede945c5..3f15be84 100644 --- a/backend/vendor/github.com/alecthomas/chroma/types.go +++ b/backend/vendor/github.com/alecthomas/chroma/types.go @@ -38,6 +38,10 @@ func (t *TokenType) UnmarshalJSON(data []byte) error { const ( // Default background style. Background TokenType = -1 - iota + // PreWrapper style. + PreWrapper + // Line style. + Line // Line numbers in output. LineNumbers // Line numbers in output when in table. @@ -48,6 +52,8 @@ const ( LineTable // Line numbers table TD wrapper style. LineTableTD + // Code line wrapper style. + CodeLine // Input that could not be tokenised. Error // Other is used by the Delegate lexer to indicate which tokens should be handled by the delegate. @@ -219,12 +225,15 @@ const ( var ( StandardTypes = map[TokenType]string{ - Background: "chroma", + Background: "bg", + PreWrapper: "chroma", + Line: "line", LineNumbers: "ln", LineNumbersTable: "lnt", LineHighlight: "hl", LineTable: "lntable", LineTableTD: "lntd", + CodeLine: "cl", Text: "", Whitespace: "w", Error: "err", diff --git a/backend/vendor/github.com/dghubble/oauth1/CHANGES.md b/backend/vendor/github.com/dghubble/oauth1/CHANGES.md index 67602940..e9ec0bcc 100644 --- a/backend/vendor/github.com/dghubble/oauth1/CHANGES.md +++ b/backend/vendor/github.com/dghubble/oauth1/CHANGES.md @@ -4,6 +4,10 @@ Notable changes between releases. ## Latest +## v0.7.1 + +* Show body when `RequestToken` or `AccessToken` requests return an invalid status code ([#54](https://github.com/dghubble/oauth1/pull/54)) + ## v0.7.0 * Add an `HMAC256Signer` ([#40](https://github.com/dghubble/oauth1/pull/40)) diff --git a/backend/vendor/github.com/dghubble/oauth1/config.go b/backend/vendor/github.com/dghubble/oauth1/config.go index a0124ff7..c539a00b 100644 --- a/backend/vendor/github.com/dghubble/oauth1/config.go +++ b/backend/vendor/github.com/dghubble/oauth1/config.go @@ -31,6 +31,8 @@ type Config struct { Signer Signer // Noncer creates request nonces (defaults to DefaultNoncer) Noncer Noncer + // HTTPClient overrides the choice of http.DefaultClient for RequestToken and AccessToken + HTTPClient *http.Client } // NewConfig returns a new Config with the given consumer key and secret. @@ -71,19 +73,21 @@ func (c *Config) RequestToken() (requestToken, requestSecret string, err error) if err != nil { return "", "", err } - resp, err := http.DefaultClient.Do(req) + resp, err := c.httpClient().Do(req) if err != nil { return "", "", err } // when err is nil, resp contains a non-nil resp.Body which must be closed defer resp.Body.Close() - if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { - return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode) - } + body, err := ioutil.ReadAll(resp.Body) if err != nil { - return "", "", err + return "", "", fmt.Errorf("oauth1: error reading Body: %v", err) } + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { + return "", "", fmt.Errorf("oauth1: invalid status %d: %s", resp.StatusCode, body) + } + // ParseQuery to decode URL-encoded application/x-www-form-urlencoded body values, err := url.ParseQuery(string(body)) if err != nil { @@ -148,19 +152,21 @@ func (c *Config) AccessToken(requestToken, requestSecret, verifier string) (acce if err != nil { return "", "", err } - resp, err := http.DefaultClient.Do(req) + resp, err := c.httpClient().Do(req) if err != nil { return "", "", err } // when err is nil, resp contains a non-nil resp.Body which must be closed defer resp.Body.Close() - if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { - return "", "", fmt.Errorf("oauth1: Server returned status %d", resp.StatusCode) - } + body, err := ioutil.ReadAll(resp.Body) if err != nil { - return "", "", err + return "", "", fmt.Errorf("oauth1: error reading Body: %v", err) } + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusCreated { + return "", "", fmt.Errorf("oauth1: invalid status %d: %s", resp.StatusCode, body) + } + // ParseQuery to decode URL-encoded application/x-www-form-urlencoded body values, err := url.ParseQuery(string(body)) if err != nil { @@ -173,3 +179,10 @@ func (c *Config) AccessToken(requestToken, requestSecret, verifier string) (acce } return accessToken, accessSecret, nil } + +func (c *Config) httpClient() *http.Client { + if c.HTTPClient != nil { + return c.HTTPClient + } + return http.DefaultClient +} diff --git a/backend/vendor/github.com/dghubble/oauth1/go.mod b/backend/vendor/github.com/dghubble/oauth1/go.mod index c6607288..29ddd889 100644 --- a/backend/vendor/github.com/dghubble/oauth1/go.mod +++ b/backend/vendor/github.com/dghubble/oauth1/go.mod @@ -1,5 +1,5 @@ module github.com/dghubble/oauth1 -go 1.12 +go 1.16 -require github.com/stretchr/testify v1.3.0 +require github.com/stretchr/testify v1.7.0 diff --git a/backend/vendor/github.com/dghubble/oauth1/go.sum b/backend/vendor/github.com/dghubble/oauth1/go.sum index 4347755a..260c90ae 100644 --- a/backend/vendor/github.com/dghubble/oauth1/go.sum +++ b/backend/vendor/github.com/dghubble/oauth1/go.sum @@ -2,6 +2,12 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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= diff --git a/backend/vendor/github.com/go-chi/chi/v5/CHANGELOG.md b/backend/vendor/github.com/go-chi/chi/v5/CHANGELOG.md index f7dcaeb8..88c68c6d 100644 --- a/backend/vendor/github.com/go-chi/chi/v5/CHANGELOG.md +++ b/backend/vendor/github.com/go-chi/chi/v5/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## v5.0.7 (2021-11-18) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.6...v5.0.7 + + +## v5.0.6 (2021-11-15) + +- History of changes: see https://github.com/go-chi/chi/compare/v5.0.5...v5.0.6 + + ## v5.0.5 (2021-10-27) - History of changes: see https://github.com/go-chi/chi/compare/v5.0.4...v5.0.5 diff --git a/backend/vendor/github.com/go-chi/chi/v5/middleware/compress.go b/backend/vendor/github.com/go-chi/chi/v5/middleware/compress.go index 75b56fd1..6cafddc7 100644 --- a/backend/vendor/github.com/go-chi/chi/v5/middleware/compress.go +++ b/backend/vendor/github.com/go-chi/chi/v5/middleware/compress.go @@ -115,7 +115,7 @@ func NewCompressor(level int, types ...string) *Compressor { // https://web.archive.org/web/20120321182910/http://www.vervestudios.co/projects/compression-tests/results // // That's why we prefer gzip over deflate. It's just more reliable - // and not significantly slower than gzip. + // and not significantly slower than deflate. c.SetEncoder("deflate", encoderDeflate) // TODO: Exception for old MSIE browsers that can't handle non-HTML? diff --git a/backend/vendor/github.com/go-chi/chi/v5/middleware/maybe.go b/backend/vendor/github.com/go-chi/chi/v5/middleware/maybe.go new file mode 100644 index 00000000..d8ca63b9 --- /dev/null +++ b/backend/vendor/github.com/go-chi/chi/v5/middleware/maybe.go @@ -0,0 +1,18 @@ +package middleware + +import "net/http" + +// Maybe middleware will allow you to change the flow of the middleware stack execution depending on return +// value of maybeFn(request). This is useful for example if you'd like to skip a middleware handler if +// a request does not satisfied the maybeFn logic. +func Maybe(mw func(http.Handler) http.Handler, maybeFn func(r *http.Request) bool) func(http.Handler) http.Handler { + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if maybeFn(r) { + mw(next).ServeHTTP(w, r) + } else { + next.ServeHTTP(w, r) + } + }) + } +} diff --git a/backend/vendor/github.com/go-chi/chi/v5/middleware/realip.go b/backend/vendor/github.com/go-chi/chi/v5/middleware/realip.go index 034b30d0..efc1894f 100644 --- a/backend/vendor/github.com/go-chi/chi/v5/middleware/realip.go +++ b/backend/vendor/github.com/go-chi/chi/v5/middleware/realip.go @@ -8,12 +8,13 @@ import ( "strings" ) +var trueClientIP = http.CanonicalHeaderKey("True-Client-IP") var xForwardedFor = http.CanonicalHeaderKey("X-Forwarded-For") var xRealIP = http.CanonicalHeaderKey("X-Real-IP") // RealIP is a middleware that sets a http.Request's RemoteAddr to the results -// of parsing either the X-Real-IP header or the X-Forwarded-For header (in that -// order). +// of parsing either the True-Client-IP, X-Real-IP or the X-Forwarded-For headers +// (in that order). // // This middleware should be inserted fairly early in the middleware stack to // ensure that subsequent layers (e.g., request loggers) which examine the @@ -40,7 +41,9 @@ func RealIP(h http.Handler) http.Handler { func realIP(r *http.Request) string { var ip string - if xrip := r.Header.Get(xRealIP); xrip != "" { + if tcip := r.Header.Get(trueClientIP); tcip != "" { + ip = tcip + } else if xrip := r.Header.Get(xRealIP); xrip != "" { ip = xrip } else if xff := r.Header.Get(xForwardedFor); xff != "" { i := strings.Index(xff, ", ") diff --git a/backend/vendor/github.com/go-pkgz/auth/auth.go b/backend/vendor/github.com/go-pkgz/auth/auth.go index d1391600..25fbb32d 100644 --- a/backend/vendor/github.com/go-pkgz/auth/auth.go +++ b/backend/vendor/github.com/go-pkgz/auth/auth.go @@ -180,7 +180,7 @@ func (s *Service) Handlers() (authHandler, avatarHandler http.Handler) { // show user info if elems[len(elems)-1] == "user" { claims, _, err := s.jwtService.Get(r) - if err != nil { + if err != nil || claims.User == nil { w.WriteHeader(http.StatusUnauthorized) rest.RenderJSON(w, rest.JSON{"error": err.Error()}) return @@ -189,10 +189,10 @@ func (s *Service) Handlers() (authHandler, avatarHandler http.Handler) { return } - // status of logged in user + // status of logged-in user if elems[len(elems)-1] == "status" { claims, _, err := s.jwtService.Get(r) - if err != nil { + if err != nil || claims.User == nil { rest.RenderJSON(w, rest.JSON{"status": "not logged in"}) return } diff --git a/backend/vendor/github.com/go-pkgz/auth/avatar/bolt.go b/backend/vendor/github.com/go-pkgz/auth/avatar/bolt.go index 937edcbf..91febd2a 100644 --- a/backend/vendor/github.com/go-pkgz/auth/avatar/bolt.go +++ b/backend/vendor/github.com/go-pkgz/auth/avatar/bolt.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "log" "github.com/pkg/errors" @@ -72,7 +71,7 @@ func (b *BoltDB) Get(avatarID string) (reader io.ReadCloser, size int, err error size, err = buf.Write(data) return errors.Wrapf(err, "failed to write for %s", avatarID) }) - return ioutil.NopCloser(buf), size, err + return io.NopCloser(buf), size, err } // ID returns a fingerprint of the avatar content. diff --git a/backend/vendor/github.com/go-pkgz/auth/avatar/gridfs.go b/backend/vendor/github.com/go-pkgz/auth/avatar/gridfs.go index 8e92df7f..4ef54f77 100644 --- a/backend/vendor/github.com/go-pkgz/auth/avatar/gridfs.go +++ b/backend/vendor/github.com/go-pkgz/auth/avatar/gridfs.go @@ -5,7 +5,6 @@ import ( "context" "fmt" "io" - "io/ioutil" "time" "github.com/pkg/errors" @@ -55,7 +54,7 @@ func (gf *GridFS) Get(avatar string) (reader io.ReadCloser, size int, err error) } buf := &bytes.Buffer{} sz, e := bucket.DownloadToStreamByName(avatar, buf) - return ioutil.NopCloser(buf), int(sz), errors.Wrapf(e, "can't read avatar %s", avatar) + return io.NopCloser(buf), int(sz), errors.Wrapf(e, "can't read avatar %s", avatar) } // diff --git a/backend/vendor/github.com/go-pkgz/auth/avatar/localfs.go b/backend/vendor/github.com/go-pkgz/auth/avatar/localfs.go index 7336c3a8..00cba8c6 100644 --- a/backend/vendor/github.com/go-pkgz/auth/avatar/localfs.go +++ b/backend/vendor/github.com/go-pkgz/auth/avatar/localfs.go @@ -35,16 +35,16 @@ func (fs *LocalFS) Put(userID string, reader io.Reader) (avatar string, err erro id := encodeID(userID) location := fs.location(id) // location adds partition to path - if e := os.MkdirAll(location, 0750); e != nil { + if e := os.MkdirAll(location, 0o750); e != nil { return "", errors.Wrapf(e, "failed to mkdir avatar location %s", location) } avFile := path.Join(location, id+imgSfx) - fh, err := os.Create(avFile) + fh, err := os.Create(avFile) //nolint if err != nil { return "", errors.Wrapf(err, "can't create file %s", avFile) } - defer func() { + defer func() { //nolint if e := fh.Close(); e != nil { err = errors.Wrapf(err, "can't close avatar file %s", avFile) } diff --git a/backend/vendor/github.com/go-pkgz/auth/avatar/noop.go b/backend/vendor/github.com/go-pkgz/auth/avatar/noop.go index 07e60dfd..7f53ca17 100644 --- a/backend/vendor/github.com/go-pkgz/auth/avatar/noop.go +++ b/backend/vendor/github.com/go-pkgz/auth/avatar/noop.go @@ -3,7 +3,6 @@ package avatar import ( "bytes" "io" - "io/ioutil" ) // NoOp is an empty (no-op) implementation of Store interface @@ -20,7 +19,7 @@ func (s *NoOp) Put(userID string, reader io.Reader) (avatarID string, err error) // Get is a NoOp implementation func (s *NoOp) Get(avatarID string) (reader io.ReadCloser, size int, err error) { - return ioutil.NopCloser(bytes.NewBuffer([]byte(""))), 0, nil + return io.NopCloser(bytes.NewBuffer([]byte(""))), 0, nil } // ID is a NoOp implementation diff --git a/backend/vendor/github.com/go-pkgz/auth/go.mod b/backend/vendor/github.com/go-pkgz/auth/go.mod index 2a962e1e..c203c3ea 100644 --- a/backend/vendor/github.com/go-pkgz/auth/go.mod +++ b/backend/vendor/github.com/go-pkgz/auth/go.mod @@ -3,23 +3,23 @@ module github.com/go-pkgz/auth go 1.17 require ( - github.com/dghubble/oauth1 v0.7.0 + github.com/dghubble/oauth1 v0.7.1 github.com/go-pkgz/repeater v1.1.3 - github.com/go-pkgz/rest v1.11.0 + github.com/go-pkgz/rest v1.12.2 github.com/golang-jwt/jwt v3.2.2+incompatible - github.com/microcosm-cc/bluemonday v1.0.16 + github.com/microcosm-cc/bluemonday v1.0.17 github.com/nullrocks/identicon v0.0.0-20180626043057-7875f45b0022 github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.7.0 go.etcd.io/bbolt v1.3.6 - go.mongodb.org/mongo-driver v1.7.4 + go.mongodb.org/mongo-driver v1.8.2 golang.org/x/image v0.0.0-20211028202545-6944b10bf410 golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 gopkg.in/oauth2.v3 v3.12.0 ) require ( - cloud.google.com/go v0.97.0 // indirect + cloud.google.com/go/compute v1.1.0 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect @@ -27,24 +27,24 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/gorilla/css v1.0.0 // indirect - github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/compress v1.14.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/tidwall/btree v0.0.0-20170113224114-9876f1454cf0 // indirect github.com/tidwall/buntdb v1.1.0 // indirect - github.com/tidwall/gjson v1.11.0 // indirect + github.com/tidwall/gjson v1.3.2 // indirect github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb // indirect - github.com/tidwall/match v1.1.1 // indirect - github.com/tidwall/pretty v1.2.0 // indirect + github.com/tidwall/match v1.0.1 // indirect + github.com/tidwall/pretty v1.0.0 // indirect github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e // indirect github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect - github.com/xdg-go/scram v1.0.2 // indirect + github.com/xdg-go/scram v1.1.0 // indirect github.com/xdg-go/stringprep v1.0.2 // indirect github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect - golang.org/x/net v0.0.0-20211105192438-b53810dc28af // indirect + golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed // indirect + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect - golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c // indirect + golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.27.1 // indirect diff --git a/backend/vendor/github.com/go-pkgz/auth/go.sum b/backend/vendor/github.com/go-pkgz/auth/go.sum index b6b1bcff..fb49e8da 100644 --- a/backend/vendor/github.com/go-pkgz/auth/go.sum +++ b/backend/vendor/github.com/go-pkgz/auth/go.sum @@ -24,14 +24,19 @@ cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWc cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ= cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI= cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW4= -cloud.google.com/go v0.97.0 h1:3DXvAyifywvq64LfkKaMOmkWPS1CikIQdMe2lY9vxU8= cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= +cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= +cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y= +cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= 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/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= +cloud.google.com/go/compute v1.1.0 h1:pyPhehLfZ6pVzRgJmXGYvCY4K7WSWRhVw0AwhgVvS84= +cloud.google.com/go/compute v1.1.0/go.mod h1:2NIffxgWfORSI7EOYMFatGTfjMLnqrOKBEyYb6NoRgA= 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= @@ -65,8 +70,8 @@ github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWH github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dghubble/oauth1 v0.7.0 h1:AlpZdbRiJM4XGHIlQ8BuJ/wlpGwFEJNnB4Mc+78tA/w= -github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4Tk1ujxk= +github.com/dghubble/oauth1 v0.7.1 h1:JjbOVSVVkms9A4h/sTQy5Jb2nFuAAVb2qVYgenJPyrE= +github.com/dghubble/oauth1 v0.7.1/go.mod h1:0eEzON0UY/OLACQrmnjgJjmvCGXzjBCsZqL1kWDXtF0= github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -89,36 +94,12 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2 github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE= github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw= -github.com/go-pkgz/rest v1.11.0 h1:Z//qgmM0NhBYfhXYEP/aJtDVLK5XlJGxqcb4sHFNN0E= -github.com/go-pkgz/rest v1.11.0/go.mod h1:wZ/dGipZUaF9to0vIQl7PwDHgWQDB0jsrFg1xnAKLDw= +github.com/go-pkgz/rest v1.12.2 h1:AQ7uuBmMcufbiUBc4IS8aqDNMvRJlhtRpXLSNRitjVo= +github.com/go-pkgz/rest v1.12.2/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= -github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= -github.com/gobuffalo/depgen v0.1.0/go.mod h1:+ifsuy7fhi15RWncXQQKjWS9JPkdah5sZvtHc2RXGlg= -github.com/gobuffalo/envy v1.6.15/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= -github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598Hb50EGs= -github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= -github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= -github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= -github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= -github.com/gobuffalo/genny v0.1.1/go.mod h1:5TExbEyY48pfunL4QSXxlDOmdsD44RRq4mVZ0Ex28Xk= -github.com/gobuffalo/gitgen v0.0.0-20190315122116-cc086187d211/go.mod h1:vEHJk/E9DmhejeLeNt7UVvlSGv3ziL+djtTr3yyzcOw= -github.com/gobuffalo/gogen v0.0.0-20190315121717-8f38393713f5/go.mod h1:V9QVDIxsgKNZs6L2IYiGR8datgMhB577vzTDqypH360= -github.com/gobuffalo/gogen v0.1.0/go.mod h1:8NTelM5qd8RZ15VjQTFkAW6qOMx5wBbW4dSCS3BY8gg= -github.com/gobuffalo/gogen v0.1.1/go.mod h1:y8iBtmHmGc4qa3urIyo1shvOD8JftTtfcKi+71xfDNE= -github.com/gobuffalo/logger v0.0.0-20190315122211-86e12af44bc2/go.mod h1:QdxcLw541hSGtBnhUc4gaNIXRjiDppFGaDqzbrBd3v8= -github.com/gobuffalo/mapi v1.0.1/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/mapi v1.0.2/go.mod h1:4VAGh89y6rVOvm5A8fKFxYG+wIW6LO1FMTG9hnKStFc= -github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWeG2RIxq4= -github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= -github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= -github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -196,6 +177,7 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ 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/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= +github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= @@ -210,33 +192,26 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= 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 h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= -github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw= +github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= -github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/microcosm-cc/bluemonday v1.0.16 h1:kHmAq2t7WPWLjiGvzKa5o3HzSfahUKiOq7fAPUiMNIc= -github.com/microcosm-cc/bluemonday v1.0.16/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= +github.com/microcosm-cc/bluemonday v1.0.17 h1:Z1a//hgsQ4yjC+8zEkV8IWySkXnsxmdSY642CTFQb5Y= +github.com/microcosm-cc/bluemonday v1.0.17/go.mod h1:Z0r70sCuXHig8YpBzCc5eGHAap2K7e/u082ZUpDRRqM= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= @@ -245,33 +220,21 @@ github.com/nullrocks/identicon v0.0.0-20180626043057-7875f45b0022/go.mod h1:x4Ns github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.2/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= @@ -282,17 +245,14 @@ github.com/tidwall/btree v0.0.0-20170113224114-9876f1454cf0 h1:QnyrPZZvPmR0AtJCx github.com/tidwall/btree v0.0.0-20170113224114-9876f1454cf0/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= github.com/tidwall/buntdb v1.1.0 h1:H6LzK59KiNjf1nHVPFrYj4Qnl8d8YLBsYamdL8N+Bao= github.com/tidwall/buntdb v1.1.0/go.mod h1:Y39xhcDW10WlyYXeLgGftXVbjtM0QP+/kpz8xl9cbzE= +github.com/tidwall/gjson v1.3.2 h1:+7p3qQFaH3fOMXAJSrdZwGKcOO/lYdGS0HqGhPqDdTI= github.com/tidwall/gjson v1.3.2/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= -github.com/tidwall/gjson v1.11.0 h1:C16pk7tQNiH6VlCrtIXL1w8GaOsi1X3W8KDkE1BuYd4= -github.com/tidwall/gjson v1.11.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb h1:5NSYaAdrnblKByzd7XByQEJVT8+9v0W/tIY0Oo4OwrE= github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb/go.mod h1:lKYYLFIr9OIgdgrtgkZ9zgRxRdvPYsExnYBsEAd8W5M= +github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e h1:+NL1GDIUOKxVfbp2KoJQD9cTQ6dyP2co9q4yzmT9FZo= github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao= github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE= @@ -304,8 +264,9 @@ github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBn github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= -github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/scram v1.1.0 h1:d70R37I0HrDLsafRrMBXyrD4lmQbCHE873t00Vr0gm0= +github.com/xdg-go/scram v1.1.0/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= @@ -331,8 +292,8 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= -go.mongodb.org/mongo-driver v1.7.4 h1:sllcioag8Mec0LYkftYWq+cKNPIR4Kqq3iv9ZXY0g/E= -go.mongodb.org/mongo-driver v1.7.4/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= +go.mongodb.org/mongo-driver v1.8.2 h1:8ssUXufb90ujcIvR6MyE1SchaNj0SFxsakiZgxIyrMk= +go.mongodb.org/mongo-driver v1.8.2/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= 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= @@ -341,16 +302,15 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/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-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed h1:YoWVYYAfvQ4ddHv3OKmIvX7NCAhFGTj62VP2l2kfBbA= +golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= 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= @@ -426,8 +386,9 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af h1:SMeNJG/vclJ5wyBBd4xupMsSJIHTd1coW9g7q6KOjmY= -golang.org/x/net v0.0.0-20211105192438-b53810dc28af/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= 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= @@ -449,7 +410,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ 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-20190412183630-56d357773e84/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= @@ -459,22 +419,18 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/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-20190419153524-e8e3143a4f4a/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-20190531175056-4c3a928424d2/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-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +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-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -512,9 +468,14 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c h1:+8miTPjMCTXwih7BQmvWwd0PjdBZq2MKp/qQaahSzEM= -golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 h1:XDXtA5hveEEV8JB2l7nhMTp3t3cHp9ZpwcdjqyEWLlo= +golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 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= @@ -535,9 +496,6 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3 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-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/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= @@ -616,7 +574,11 @@ google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNe google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU= google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k= google.golang.org/api v0.55.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= +google.golang.org/api v0.56.0/go.mod h1:38yMfeP1kfjsl8isn0tliTjIb1rJXcQi4UXlbqivdVE= google.golang.org/api v0.57.0/go.mod h1:dVPlbZyBo2/OjBpmvNdpn2GRm6rPy75jyU7bmhdrMgI= +google.golang.org/api v0.61.0/go.mod h1:xQRti5UdCmoCEqFxcz93fTl338AVqDgyaDRuOZ3hg9I= +google.golang.org/api v0.63.0/go.mod h1:gs4ij2ffTRXwuzzgJl/56BdwJaA194ijkfn++9tDuPo= +google.golang.org/api v0.65.0/go.mod h1:ArYhxgGadlWmqO1IqVujw6Cs8IdD33bTmzKo2Sh+cbg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 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= @@ -679,7 +641,14 @@ google.golang.org/genproto v0.0.0-20210821163610-241b8fcbd6c8/go.mod h1:eFjDcFEc google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210831024726-fe130286e0e2/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= +google.golang.org/genproto v0.0.0-20210909211513-a8c4777a87af/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY= google.golang.org/genproto v0.0.0-20210924002016-3dee208752a0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211206160659-862468c7d6e0/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20211221195035-429b39de9b1c/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20220111164026-67b88f271998/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -705,6 +674,7 @@ google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQ google.golang.org/grpc v1.39.0/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.39.1/go.mod h1:PImNr+rS9TWYb2O4/emRugxiyHZ5JyHW5F+RPnDzfrE= google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= 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= @@ -731,7 +701,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/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= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/backend/vendor/github.com/go-pkgz/auth/provider/apple.go b/backend/vendor/github.com/go-pkgz/auth/provider/apple.go index 3f7156d8..87479dfe 100644 --- a/backend/vendor/github.com/go-pkgz/auth/provider/apple.go +++ b/backend/vendor/github.com/go-pkgz/auth/provider/apple.go @@ -14,7 +14,7 @@ import ( "encoding/json" "encoding/pem" "fmt" - "io/ioutil" + "io" "net/http" "net/url" "os" @@ -126,7 +126,7 @@ func (lf LoadFromFileFunc) LoadPrivateKey() ([]byte, error) { if err != nil { return nil, err } - keyValue, err := ioutil.ReadAll(keyFile) + keyValue, err := io.ReadAll(keyFile) if err != nil { return nil, err } diff --git a/backend/vendor/github.com/go-pkgz/auth/provider/apple_pubkeys.go b/backend/vendor/github.com/go-pkgz/auth/provider/apple_pubkeys.go index a1207391..b95d78e1 100644 --- a/backend/vendor/github.com/go-pkgz/auth/provider/apple_pubkeys.go +++ b/backend/vendor/github.com/go-pkgz/auth/provider/apple_pubkeys.go @@ -11,7 +11,7 @@ import ( "encoding/base64" "encoding/json" "fmt" - "io/ioutil" + "io" "math/big" "net/http" "time" @@ -53,7 +53,7 @@ func fetchAppleJWK(ctx context.Context, keyURL string) (set appleKeySet, err err keyURL = appleKeysURL } - req, err := http.NewRequestWithContext(ctx, "GET", keyURL, nil) + req, err := http.NewRequestWithContext(ctx, "GET", keyURL, http.NoBody) if err != nil { return set, errors.Wrap(err, "failed to prepare new request for fetch Apple public keys") @@ -67,7 +67,7 @@ func fetchAppleJWK(ctx context.Context, keyURL string) (set appleKeySet, err err return set, errors.Wrap(err, "failed to fetch Apple public keys") } - data, err := ioutil.ReadAll(res.Body) + data, err := io.ReadAll(res.Body) if err != nil { return set, errors.Wrap(err, "failed read data after Apple public key fetched") } diff --git a/backend/vendor/github.com/go-pkgz/auth/provider/oauth1.go b/backend/vendor/github.com/go-pkgz/auth/provider/oauth1.go index 73cb11f9..4aec7f56 100644 --- a/backend/vendor/github.com/go-pkgz/auth/provider/oauth1.go +++ b/backend/vendor/github.com/go-pkgz/auth/provider/oauth1.go @@ -3,7 +3,7 @@ package provider import ( "context" "encoding/json" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -113,7 +113,7 @@ func (h Oauth1Handler) AuthHandler(w http.ResponseWriter, r *http.Request) { } }() - data, err := ioutil.ReadAll(uinfo.Body) + data, err := io.ReadAll(uinfo.Body) if err != nil { rest.SendErrorJSON(w, r, h.L, http.StatusInternalServerError, err, "failed to read user info") return diff --git a/backend/vendor/github.com/go-pkgz/auth/provider/oauth2.go b/backend/vendor/github.com/go-pkgz/auth/provider/oauth2.go index 644de4af..d2c8dd7c 100644 --- a/backend/vendor/github.com/go-pkgz/auth/provider/oauth2.go +++ b/backend/vendor/github.com/go-pkgz/auth/provider/oauth2.go @@ -4,7 +4,7 @@ import ( "context" "encoding/json" "fmt" - "io/ioutil" + "io" "net/http" "strings" "time" @@ -172,7 +172,7 @@ func (p Oauth2Handler) AuthHandler(w http.ResponseWriter, r *http.Request) { } }() - data, err := ioutil.ReadAll(uinfo.Body) + data, err := io.ReadAll(uinfo.Body) if err != nil { rest.SendErrorJSON(w, r, p.L, http.StatusInternalServerError, err, "failed to read user info") return diff --git a/backend/vendor/github.com/go-pkgz/auth/provider/telegram.go b/backend/vendor/github.com/go-pkgz/auth/provider/telegram.go index 110d3ee9..df01dbde 100644 --- a/backend/vendor/github.com/go-pkgz/auth/provider/telegram.go +++ b/backend/vendor/github.com/go-pkgz/auth/provider/telegram.go @@ -70,13 +70,12 @@ func (th *TelegramHandler) Run(ctx context.Context) error { if err != nil { return errors.Wrap(err, "failed to fetch bot info") } + th.username = info.Username th.requests.Lock() th.requests.data = make(map[string]tgAuthRequest) th.requests.Unlock() - th.username = info.Username - processUpdatedTicker := time.NewTicker(apiPollInterval) cleanupTicker := time.NewTicker(expiredCleanupInterval) @@ -271,6 +270,16 @@ func (th *TelegramHandler) LoginHandler(w http.ResponseWriter, r *http.Request) return } + // verify that we have a username, which is not set if Run was not used + if th.username == "" { + info, err := th.Telegram.BotInfo(r.Context()) + if err != nil { + rest.SendErrorJSON(w, r, th.L, http.StatusInternalServerError, err, "failed to fetch bot username") + return + } + th.username = info.Username + } + rest.RenderJSON(w, struct { Token string `json:"token"` Bot string `json:"bot"` @@ -442,7 +451,7 @@ func (tg *tgAPI) request(ctx context.Context, method string, data interface{}) e return repeater.NewDefault(3, time.Millisecond*50).Do(ctx, func() error { url := fmt.Sprintf("https://api.telegram.org/bot%s/%s", tg.token, method) - req, err := http.NewRequestWithContext(ctx, "GET", url, nil) + req, err := http.NewRequestWithContext(ctx, "GET", url, http.NoBody) if err != nil { return errors.Wrap(err, "failed to create request") } diff --git a/backend/vendor/github.com/go-pkgz/rest/.golangci.yml b/backend/vendor/github.com/go-pkgz/rest/.golangci.yml index 4cd6d427..824667f8 100644 --- a/backend/vendor/github.com/go-pkgz/rest/.golangci.yml +++ b/backend/vendor/github.com/go-pkgz/rest/.golangci.yml @@ -27,7 +27,7 @@ linters-settings: linters: enable: - megacheck - - golint + - revive - govet - unconvert - megacheck diff --git a/backend/vendor/github.com/go-pkgz/rest/README.md b/backend/vendor/github.com/go-pkgz/rest/README.md index 5769f2c9..c78ddeec 100644 --- a/backend/vendor/github.com/go-pkgz/rest/README.md +++ b/backend/vendor/github.com/go-pkgz/rest/README.md @@ -119,3 +119,19 @@ Compresses response with gzip. - `rest.SendErrorJSON` - makes `{error: blah, details: blah}` json body and responds with given error code. Also, adds context to the logged message - `rest.NewErrorLogger` - creates a struct providing shorter form of logger call - `rest.FileServer` - creates a file server for static assets with directory listing disabled + +## Profiler + +Profiler is a convenient subrouter used for mounting net/http/pprof, i.e. + +```go + func MyService() http.Handler { + r := chi.NewRouter() + // ..middlewares + r.Mount("/debug", middleware.Profiler()) + // ..routes + return r + } +``` +It exposes a whole bunch of `/pprof/*` endpoints as well as `/vars`. Builtin support for `onlyIps` allows to restrict access, which is important if it runs on a publicly exposed port. However, counting on IP check only is not that reliable way to limit request and for production use it would be better to add some sort of auth (for example provided `BasicAuth` middleware) or run with a separate http server, exposed to internal ip/port only. + diff --git a/backend/vendor/github.com/go-pkgz/rest/blackwords.go b/backend/vendor/github.com/go-pkgz/rest/blackwords.go index 08f1c647..dd120d7a 100644 --- a/backend/vendor/github.com/go-pkgz/rest/blackwords.go +++ b/backend/vendor/github.com/go-pkgz/rest/blackwords.go @@ -2,7 +2,7 @@ package rest import ( "bytes" - "io/ioutil" + "io" "net/http" "strings" ) @@ -13,9 +13,9 @@ func BlackWords(words ...string) func(http.Handler) http.Handler { return func(h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { - if content, err := ioutil.ReadAll(r.Body); err == nil { + if content, err := io.ReadAll(r.Body); err == nil { body := strings.ToLower(string(content)) - r.Body = ioutil.NopCloser(bytes.NewReader(content)) + r.Body = io.NopCloser(bytes.NewReader(content)) if len(body) > 0 { for _, word := range words { diff --git a/backend/vendor/github.com/go-pkgz/rest/depricattion.go b/backend/vendor/github.com/go-pkgz/rest/depricattion.go index 7b5f7131..ded640b6 100644 --- a/backend/vendor/github.com/go-pkgz/rest/depricattion.go +++ b/backend/vendor/github.com/go-pkgz/rest/depricattion.go @@ -11,7 +11,7 @@ import ( func Deprecation(version string, date time.Time) func(http.Handler) http.Handler { f := func(h http.Handler) http.Handler { fn := func(w http.ResponseWriter, r *http.Request) { - headerVal := fmt.Sprintf("version=\"%s\", date=\"%s\"", version, date.Format(time.RFC3339)) + headerVal := fmt.Sprintf("version=%q, date=%q", version, date.Format(time.RFC3339)) w.Header().Set("Deprecation", headerVal) h.ServeHTTP(w, r) } diff --git a/backend/vendor/github.com/go-pkgz/rest/file_server.go b/backend/vendor/github.com/go-pkgz/rest/file_server.go index fc6a15d7..ccf47df5 100644 --- a/backend/vendor/github.com/go-pkgz/rest/file_server.go +++ b/backend/vendor/github.com/go-pkgz/rest/file_server.go @@ -3,74 +3,146 @@ package rest import ( "fmt" "io" - "io/ioutil" "net/http" "os" "path/filepath" "strings" ) -// FileServer returns http.FileServer handler to serve static files from a http.FileSystem, -// prevents directory listing. +// FS provides http.FileServer handler to serve static files from a http.FileSystem, +// prevents directory listing by default and supports spa-friendly mode (off by default) returning /index.html on 404. // - public defines base path of the url, i.e. for http://example.com/static/* it should be /static // - local for the local path to the root of the served directory // - notFound is the reader for the custom 404 html, can be nil for default -func FileServer(public, local string, notFound io.Reader) (http.Handler, error) { +type FS struct { + public, root string + notFound io.Reader + isSpa bool + enableListing bool + handler http.HandlerFunc +} + +// NewFileServer creates file server with optional spa mode and optional direcroty listing (disabled by default) +func NewFileServer(public, local string, options ...FsOpt) (*FS, error) { + res := FS{ + public: public, + notFound: nil, + isSpa: false, + enableListing: false, + } root, err := filepath.Abs(local) if err != nil { return nil, fmt.Errorf("can't get absolute path for %s: %w", local, err) } + res.root = root + if _, err = os.Stat(root); os.IsNotExist(err) { return nil, fmt.Errorf("local path %s doesn't exist: %w", root, err) } - fs := http.StripPrefix(public, http.FileServer(noDirListingFS{http.Dir(root), false})) - return custom404Handler(fs, notFound) -} - -// FileServerSPA returns FileServer as above, but instead of no-found returns /local/index.html -func FileServerSPA(public, local string, notFound io.Reader) (http.Handler, error) { - - root, err := filepath.Abs(local) - if err != nil { - return nil, fmt.Errorf("can't get absolute path for %s: %w", local, err) - } - if _, err = os.Stat(root); os.IsNotExist(err) { - return nil, fmt.Errorf("local path %s doesn't exist: %w", root, err) - } - - fs := http.StripPrefix(public, http.FileServer(noDirListingFS{http.Dir(root), true})) - return custom404Handler(fs, notFound) -} - -type noDirListingFS struct { - fs http.FileSystem - spa bool -} - -// Open file on FS, for directory enforce index.html and fail on a missing index -func (fs noDirListingFS) Open(name string) (http.File, error) { - - f, err := fs.fs.Open(name) - if err != nil { - if fs.spa { - return fs.fs.Open("/index.html") - } - return nil, err - } - - s, err := f.Stat() - if err != nil { - return nil, err - } - - if s.IsDir() { - index := strings.TrimSuffix(name, "/") + "/index.html" - if _, err := fs.fs.Open(index); err != nil { + for _, opt := range options { + err = opt(&res) + if err != nil { return nil, err } } + + cfs := customFS{ + fs: http.Dir(root), + spa: res.isSpa, + listing: res.enableListing, + } + f := http.StripPrefix(public, http.FileServer(cfs)) + res.handler = func(w http.ResponseWriter, r *http.Request) { f.ServeHTTP(w, r) } + + if !res.enableListing { + h, err := custom404Handler(f, res.notFound) + if err != nil { + return nil, err + } + res.handler = func(w http.ResponseWriter, r *http.Request) { h.ServeHTTP(w, r) } + } + + return &res, nil +} + +// FileServer is a shortcut for making FS with listing disabled and the custom noFound reader (can be nil). +// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead +func FileServer(public, local string, notFound io.Reader) (http.Handler, error) { + return NewFileServer(public, local, FsOptCustom404(notFound)) +} + +// FileServerSPA is a shortcut for making FS with SPA-friendly handling of 404, listing disabled and the custom noFound reader (can be nil). +// Deprecated: the method is for back-compatibility only and user should use the universal NewFileServer instead +func FileServerSPA(public, local string, notFound io.Reader) (http.Handler, error) { + return NewFileServer(public, local, FsOptCustom404(notFound), FsOptSPA) +} + +// ServeHTTP makes FileServer compatible with http.Handler interface +func (fs *FS) ServeHTTP(w http.ResponseWriter, r *http.Request) { + fs.handler(w, r) +} + +// FsOpt defines functional option type +type FsOpt func(fs *FS) error + +// FsOptSPA turns on SPA mode returning "/index.html" on not-found +func FsOptSPA(fs *FS) error { + fs.isSpa = true + return nil +} + +// FsOptListing turns on directory listing +func FsOptListing(fs *FS) error { + fs.enableListing = true + return nil +} + +// FsOptCustom404 sets custom 404 reader +func FsOptCustom404(fr io.Reader) FsOpt { + return func(fs *FS) error { + fs.notFound = fr + return nil + } +} + +// customFS wraps http.FileSystem with spa and no-listing optional support +type customFS struct { + fs http.FileSystem + spa bool + listing bool +} + +// Open file on FS, for directory enforce index.html and fail on a missing index +func (cfs customFS) Open(name string) (http.File, error) { + + f, err := cfs.fs.Open(name) + if err != nil { + if cfs.spa { + return cfs.fs.Open("/index.html") + } + return nil, err + } + + finfo, err := f.Stat() + if err != nil { + return nil, err + } + + if finfo.IsDir() { + index := strings.TrimSuffix(name, "/") + "/index.html" + if _, err := cfs.fs.Open(index); err == nil { // index.html will be served if found + return f, nil + } + // no index.html in directory + if !cfs.listing { // listing disabled + if _, err := cfs.fs.Open(index); err != nil { + return nil, err + } + } + } + return f, nil } @@ -83,6 +155,9 @@ type respWriter404 struct { func (w *respWriter404) WriteHeader(status int) { w.status = status + if status == http.StatusNotFound { + w.Header().Set("Content-Type", "text/html; charset=utf-8") + } w.ResponseWriter.WriteHeader(status) } @@ -99,7 +174,7 @@ func custom404Handler(next http.Handler, notFound io.Reader) (http.Handler, erro return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { next.ServeHTTP(w, r) }), nil } - body, err := ioutil.ReadAll(notFound) + body, err := io.ReadAll(notFound) if err != nil { return nil, err } diff --git a/backend/vendor/github.com/go-pkgz/rest/go.mod b/backend/vendor/github.com/go-pkgz/rest/go.mod index 7898921e..5a64a6d6 100644 --- a/backend/vendor/github.com/go-pkgz/rest/go.mod +++ b/backend/vendor/github.com/go-pkgz/rest/go.mod @@ -1,6 +1,6 @@ module github.com/go-pkgz/rest -go 1.15 +go 1.16 require ( github.com/pkg/errors v0.9.1 diff --git a/backend/vendor/github.com/go-pkgz/rest/go.sum b/backend/vendor/github.com/go-pkgz/rest/go.sum index 0caa82c6..22c86e53 100644 --- a/backend/vendor/github.com/go-pkgz/rest/go.sum +++ b/backend/vendor/github.com/go-pkgz/rest/go.sum @@ -4,10 +4,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= diff --git a/backend/vendor/github.com/go-pkgz/rest/gzip.go b/backend/vendor/github.com/go-pkgz/rest/gzip.go index c5e77c90..a7328b05 100644 --- a/backend/vendor/github.com/go-pkgz/rest/gzip.go +++ b/backend/vendor/github.com/go-pkgz/rest/gzip.go @@ -3,7 +3,6 @@ package rest import ( "compress/gzip" "io" - "io/ioutil" "net/http" "strings" "sync" @@ -21,7 +20,7 @@ var gzDefaultContentTypes = []string{ } var gzPool = sync.Pool{ - New: func() interface{} { return gzip.NewWriter(ioutil.Discard) }, + New: func() interface{} { return gzip.NewWriter(io.Discard) }, } type gzipResponseWriter struct { diff --git a/backend/vendor/github.com/go-pkgz/rest/logger/logger.go b/backend/vendor/github.com/go-pkgz/rest/logger/logger.go index a95d592b..cc7d9e5f 100644 --- a/backend/vendor/github.com/go-pkgz/rest/logger/logger.go +++ b/backend/vendor/github.com/go-pkgz/rest/logger/logger.go @@ -6,7 +6,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -220,7 +219,7 @@ func (l *Middleware) getBody(r *http.Request) string { // Note that below assignment is not approved by the docs: // "Except for reading the body, handlers should not modify the provided Request." // https://golang.org/pkg/net/http/#Handler - r.Body = ioutil.NopCloser(reader) + r.Body = io.NopCloser(reader) if len(body) > 0 { body = strings.Replace(body, "\n", " ", -1) diff --git a/backend/vendor/github.com/go-pkgz/rest/middleware.go b/backend/vendor/github.com/go-pkgz/rest/middleware.go index a40e02c2..7e09e7eb 100644 --- a/backend/vendor/github.com/go-pkgz/rest/middleware.go +++ b/backend/vendor/github.com/go-pkgz/rest/middleware.go @@ -90,3 +90,19 @@ func Headers(headers ...string) func(http.Handler) http.Handler { return http.HandlerFunc(fn) } } + +// Maybe middleware will allow you to change the flow of the middleware stack execution depending on return +// value of maybeFn(request). This is useful for example if you'd like to skip a middleware handler if +// a request does not satisfied the maybeFn logic. +// borrowed from https://github.com/go-chi/chi/blob/master/middleware/maybe.go +func Maybe(mw func(http.Handler) http.Handler, maybeFn func(r *http.Request) bool) func(http.Handler) http.Handler { + return func(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if maybeFn(r) { + mw(next).ServeHTTP(w, r) + } else { + next.ServeHTTP(w, r) + } + }) + } +} diff --git a/backend/vendor/github.com/go-pkgz/rest/profiler.go b/backend/vendor/github.com/go-pkgz/rest/profiler.go new file mode 100644 index 00000000..13fecbd7 --- /dev/null +++ b/backend/vendor/github.com/go-pkgz/rest/profiler.go @@ -0,0 +1,48 @@ +package rest + +import ( + "expvar" + "fmt" + "net/http" + "net/http/pprof" +) + +// Profiler is a convenient subrouter used for mounting net/http/pprof. ie. +// +// func MyService() http.Handler { +// r := chi.NewRouter() +// // ..middlewares +// r.Mount("/debug", middleware.Profiler()) +// // ..routes +// return r +// } +func Profiler(onlyIps ...string) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/pprof/", pprof.Index) + mux.HandleFunc("/pprof/cmdline", pprof.Cmdline) + mux.HandleFunc("/pprof/profile", pprof.Profile) + mux.HandleFunc("/pprof/symbol", pprof.Symbol) + mux.HandleFunc("/pprof/trace", pprof.Trace) + mux.Handle("/pprof/block", pprof.Handler("block")) + mux.Handle("/pprof/heap", pprof.Handler("heap")) + mux.Handle("/pprof/goroutine", pprof.Handler("goroutine")) + mux.Handle("/pprof/threadcreate", pprof.Handler("threadcreate")) + mux.HandleFunc("/vars", expVars) + + return Wrap(mux, NoCache, OnlyFrom(onlyIps...)) +} + +// expVars copied from stdlib expvar.go as is not public. +func expVars(w http.ResponseWriter, r *http.Request) { + first := true + w.Header().Set("Content-Type", "application/json") + fmt.Fprintf(w, "{\n") + expvar.Do(func(kv expvar.KeyValue) { + if !first { + fmt.Fprintf(w, ",\n") + } + first = false + fmt.Fprintf(w, "%q: %s", kv.Key, kv.Value) + }) + fmt.Fprintf(w, "\n}\n") +} diff --git a/backend/vendor/github.com/go-pkgz/rest/sizelimit.go b/backend/vendor/github.com/go-pkgz/rest/sizelimit.go index 6770e882..cfa03188 100644 --- a/backend/vendor/github.com/go-pkgz/rest/sizelimit.go +++ b/backend/vendor/github.com/go-pkgz/rest/sizelimit.go @@ -3,7 +3,6 @@ package rest import ( "bytes" "io" - "io/ioutil" "net/http" ) @@ -21,7 +20,7 @@ func SizeLimit(size int64) func(http.Handler) http.Handler { } // check size of the actual body - content, err := ioutil.ReadAll(io.LimitReader(r.Body, size+1)) + content, err := io.ReadAll(io.LimitReader(r.Body, size+1)) if err != nil { w.WriteHeader(http.StatusServiceUnavailable) return @@ -32,7 +31,7 @@ func SizeLimit(size int64) func(http.Handler) http.Handler { w.WriteHeader(http.StatusRequestEntityTooLarge) return } - r.Body = ioutil.NopCloser(bytes.NewReader(content)) + r.Body = io.NopCloser(bytes.NewReader(content)) h.ServeHTTP(w, r) } diff --git a/backend/vendor/github.com/go-pkgz/syncs/.golangci.yml b/backend/vendor/github.com/go-pkgz/syncs/.golangci.yml index 989af86e..9c7aee4a 100644 --- a/backend/vendor/github.com/go-pkgz/syncs/.golangci.yml +++ b/backend/vendor/github.com/go-pkgz/syncs/.golangci.yml @@ -25,9 +25,9 @@ linters-settings: - wrapperFunc linters: - disable-all: true enable: - megacheck + - revive - govet - unconvert - megacheck @@ -42,19 +42,28 @@ linters: - typecheck - ineffassign - varcheck + - stylecheck + - gochecknoinits + - exportloopref + - gocritic + - nakedret + - gosimple + - prealloc fast: false - + disable-all: true run: -# modules-download-mode: vendor + output: + format: tab skip-dirs: - vendor issues: exclude-rules: - - text: "weak cryptographic primitive" + - text: "should have a package comment, unless it's in another file for this package" linters: - - gosec - -service: - golangci-lint-version: 1.16.x \ No newline at end of file + - golint + - text: "at least one file in a package should have a package comment" + linters: + - stylecheck + exclude-use-default: false diff --git a/backend/vendor/github.com/go-pkgz/syncs/.travis.yml b/backend/vendor/github.com/go-pkgz/syncs/.travis.yml deleted file mode 100644 index 697ce97f..00000000 --- a/backend/vendor/github.com/go-pkgz/syncs/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: go - -go: - - "1.12.x" - -install: true - -before_install: - - export TZ=America/Chicago - - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.13.2 - - go get github.com/mattn/goveralls - - export PATH=$(pwd)/bin:$PATH - -script: - - GO111MODULE=on go get ./... - - GO111MODULE=on go mod vendor - - GO111MODULE=on go test -v -mod=vendor -covermode=count -coverprofile=profile.cov ./... || travis_terminate 1; - - GO111MODULE=on go test -v -covermode=count -coverprofile=profile.cov ./... || travis_terminate 1; - - golangci-lint run || travis_terminate 1; - - $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci diff --git a/backend/vendor/github.com/go-pkgz/syncs/LICENSE b/backend/vendor/github.com/go-pkgz/syncs/LICENSE index ac540250..682ea0c0 100644 --- a/backend/vendor/github.com/go-pkgz/syncs/LICENSE +++ b/backend/vendor/github.com/go-pkgz/syncs/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Umputun +Copyright (c) 2021 Umputun Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/backend/vendor/github.com/go-pkgz/syncs/README.md b/backend/vendor/github.com/go-pkgz/syncs/README.md index 9599cb95..34535845 100644 --- a/backend/vendor/github.com/go-pkgz/syncs/README.md +++ b/backend/vendor/github.com/go-pkgz/syncs/README.md @@ -1,6 +1,6 @@ # Syncs - additional synchronization primitives -[![Build Status](https://travis-ci.org/go-pkgz/syncs.svg?branch=master)](https://travis-ci.org/go-pkgz/syncs) [![Go Report Card](https://goreportcard.com/badge/github.com/go-pkgz/syncs)](https://goreportcard.com/report/github.com/go-pkgz/syncs) [![Coverage Status](https://coveralls.io/repos/github/go-pkgz/syncs/badge.svg?branch=master)](https://coveralls.io/github/go-pkgz/syncs?branch=master) +[![Build Status](https://github.com/go-pkgz/syncs/workflows/build/badge.svg)](https://github.com/go-pkgz/syncs/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/go-pkgz/syncs)](https://goreportcard.com/report/github.com/go-pkgz/syncs) [![Coverage Status](https://coveralls.io/repos/github/go-pkgz/syncs/badge.svg?branch=master)](https://coveralls.io/github/go-pkgz/syncs?branch=master) Package syncs provides additional synchronization primitives. @@ -29,7 +29,7 @@ Implements `sync.Locker` interface but for given capacity, thread safe. Lock inc Mix semaphore and WaitGroup to provide sized waiting group. The result is a wait group allowing limited number of goroutine to run in parallel. -By default the locking happens inside of goroutine, i.e. **every call will be non-blocked**, but some goroutines may wait if semaphore locked. It means - technically it doesn't limit number of goroutines, but rather number of running (active) goroutines. +By default, the locking happens inside of goroutine, i.e. **every call will be non-blocked**, but some goroutines may wait if semaphore locked. It means - technically it doesn't limit number of goroutines, but rather number of running (active) goroutines. In order to block goroutines from even starting use `Preemptive` option (see below). ```go diff --git a/backend/vendor/github.com/go-pkgz/syncs/go.mod b/backend/vendor/github.com/go-pkgz/syncs/go.mod index 20a3a4d6..d8a3a20d 100644 --- a/backend/vendor/github.com/go-pkgz/syncs/go.mod +++ b/backend/vendor/github.com/go-pkgz/syncs/go.mod @@ -1,3 +1,5 @@ module github.com/go-pkgz/syncs -require github.com/stretchr/testify v1.3.0 +require github.com/stretchr/testify v1.7.0 + +go 1.16 diff --git a/backend/vendor/github.com/go-pkgz/syncs/go.sum b/backend/vendor/github.com/go-pkgz/syncs/go.sum index 4347755a..acb88a48 100644 --- a/backend/vendor/github.com/go-pkgz/syncs/go.sum +++ b/backend/vendor/github.com/go-pkgz/syncs/go.sum @@ -3,5 +3,9 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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= diff --git a/backend/vendor/github.com/go-redis/redis/v7/.gitignore b/backend/vendor/github.com/go-redis/redis/v7/.gitignore index ebfe903b..b975a7b4 100644 --- a/backend/vendor/github.com/go-redis/redis/v7/.gitignore +++ b/backend/vendor/github.com/go-redis/redis/v7/.gitignore @@ -1,2 +1,3 @@ *.rdb testdata/*/ +.idea/ diff --git a/backend/vendor/github.com/go-redis/redis/v7/redis.go b/backend/vendor/github.com/go-redis/redis/v7/redis.go index 3d9dfed7..ac0569f5 100644 --- a/backend/vendor/github.com/go-redis/redis/v7/redis.go +++ b/backend/vendor/github.com/go-redis/redis/v7/redis.go @@ -473,11 +473,11 @@ func wrapMultiExec(cmds []Cmder) []Cmder { if len(cmds) == 0 { panic("not reached") } - cmds = append(cmds, make([]Cmder, 2)...) - copy(cmds[1:], cmds[:len(cmds)-2]) - cmds[0] = NewStatusCmd("multi") - cmds[len(cmds)-1] = NewSliceCmd("exec") - return cmds + cmdCopy := make([]Cmder, len(cmds)+2) + cmdCopy[0] = NewStatusCmd("multi") + copy(cmdCopy[1:], cmds) + cmdCopy[len(cmdCopy)-1] = NewSliceCmd("exec") + return cmdCopy } func txPipelineReadQueued(rd *proto.Reader, statusCmd *StatusCmd, cmds []Cmder) error { diff --git a/backend/vendor/github.com/hashicorp/errwrap/errwrap.go b/backend/vendor/github.com/hashicorp/errwrap/errwrap.go index a733bef1..44e368e5 100644 --- a/backend/vendor/github.com/hashicorp/errwrap/errwrap.go +++ b/backend/vendor/github.com/hashicorp/errwrap/errwrap.go @@ -44,6 +44,8 @@ func Wrap(outer, inner error) error { // // format is the format of the error message. The string '{{err}}' will // be replaced with the original error message. +// +// Deprecated: Use fmt.Errorf() func Wrapf(format string, err error) error { outerMsg := "" if err != nil { @@ -148,6 +150,9 @@ func Walk(err error, cb WalkFunc) { for _, err := range e.WrappedErrors() { Walk(err, cb) } + case interface{ Unwrap() error }: + cb(err) + Walk(e.Unwrap(), cb) default: cb(err) } @@ -167,3 +172,7 @@ func (w *wrappedError) Error() string { func (w *wrappedError) WrappedErrors() []error { return []error{w.Outer, w.Inner} } + +func (w *wrappedError) Unwrap() error { + return w.Inner +} diff --git a/backend/vendor/github.com/umputun/go-flags/.travis.yml b/backend/vendor/github.com/jessevdk/go-flags/.travis.yml similarity index 95% rename from backend/vendor/github.com/umputun/go-flags/.travis.yml rename to backend/vendor/github.com/jessevdk/go-flags/.travis.yml index 06dbe728..2fc5e5f5 100644 --- a/backend/vendor/github.com/umputun/go-flags/.travis.yml +++ b/backend/vendor/github.com/jessevdk/go-flags/.travis.yml @@ -5,13 +5,10 @@ os: - osx go: - - 1.x - - 1.9.x - - 1.10.x + - 1.16.x install: # go-flags - - go get -d -v ./... - go build -v ./... # linting diff --git a/backend/vendor/github.com/umputun/go-flags/LICENSE b/backend/vendor/github.com/jessevdk/go-flags/LICENSE similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/LICENSE rename to backend/vendor/github.com/jessevdk/go-flags/LICENSE diff --git a/backend/vendor/github.com/umputun/go-flags/README.md b/backend/vendor/github.com/jessevdk/go-flags/README.md similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/README.md rename to backend/vendor/github.com/jessevdk/go-flags/README.md diff --git a/backend/vendor/github.com/umputun/go-flags/arg.go b/backend/vendor/github.com/jessevdk/go-flags/arg.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/arg.go rename to backend/vendor/github.com/jessevdk/go-flags/arg.go diff --git a/backend/vendor/github.com/umputun/go-flags/check_crosscompile.sh b/backend/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh similarity index 76% rename from backend/vendor/github.com/umputun/go-flags/check_crosscompile.sh rename to backend/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh index c494f611..5edc430e 100644 --- a/backend/vendor/github.com/umputun/go-flags/check_crosscompile.sh +++ b/backend/vendor/github.com/jessevdk/go-flags/check_crosscompile.sh @@ -14,3 +14,7 @@ echo '# darwin' GOARCH=amd64 GOOS=darwin go build echo '# freebsd' GOARCH=amd64 GOOS=freebsd go build +echo '# aix ppc64' +GOARCH=ppc64 GOOS=aix go build +echo '# solaris amd64' +GOARCH=amd64 GOOS=solaris go build diff --git a/backend/vendor/github.com/umputun/go-flags/closest.go b/backend/vendor/github.com/jessevdk/go-flags/closest.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/closest.go rename to backend/vendor/github.com/jessevdk/go-flags/closest.go diff --git a/backend/vendor/github.com/umputun/go-flags/command.go b/backend/vendor/github.com/jessevdk/go-flags/command.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/command.go rename to backend/vendor/github.com/jessevdk/go-flags/command.go diff --git a/backend/vendor/github.com/umputun/go-flags/completion.go b/backend/vendor/github.com/jessevdk/go-flags/completion.go similarity index 98% rename from backend/vendor/github.com/umputun/go-flags/completion.go rename to backend/vendor/github.com/jessevdk/go-flags/completion.go index 813a672c..8ed61f1d 100644 --- a/backend/vendor/github.com/umputun/go-flags/completion.go +++ b/backend/vendor/github.com/jessevdk/go-flags/completion.go @@ -82,7 +82,7 @@ func (c *completion) skipPositional(s *parseState, n int) { func (c *completion) completeOptionNames(s *parseState, prefix string, match string, short bool) []Completion { if short && len(match) != 0 { return []Completion{ - Completion{ + { Item: prefix + match, }, } @@ -130,7 +130,7 @@ func (c *completion) completeCommands(s *parseState, match string) []Completion n := make([]Completion, 0, len(s.command.commands)) for _, cmd := range s.command.commands { - if cmd.data != c && strings.HasPrefix(cmd.Name, match) { + if cmd.data != c && !cmd.Hidden && strings.HasPrefix(cmd.Name, match) { n = append(n, Completion{ Item: cmd.Name, Description: cmd.ShortDescription, diff --git a/backend/vendor/github.com/umputun/go-flags/convert.go b/backend/vendor/github.com/jessevdk/go-flags/convert.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/convert.go rename to backend/vendor/github.com/jessevdk/go-flags/convert.go diff --git a/backend/vendor/github.com/umputun/go-flags/error.go b/backend/vendor/github.com/jessevdk/go-flags/error.go similarity index 98% rename from backend/vendor/github.com/umputun/go-flags/error.go rename to backend/vendor/github.com/jessevdk/go-flags/error.go index 05528d8d..73e07cfc 100644 --- a/backend/vendor/github.com/umputun/go-flags/error.go +++ b/backend/vendor/github.com/jessevdk/go-flags/error.go @@ -97,6 +97,10 @@ func (e ErrorType) String() string { return "unrecognized error type" } +func (e ErrorType) Error() string { + return e.String() +} + // Error represents a parser error. The error returned from Parse is of this // type. The error contains both a Type and Message. type Error struct { diff --git a/backend/vendor/github.com/umputun/go-flags/flags.go b/backend/vendor/github.com/jessevdk/go-flags/flags.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/flags.go rename to backend/vendor/github.com/jessevdk/go-flags/flags.go diff --git a/backend/vendor/github.com/jessevdk/go-flags/go.mod b/backend/vendor/github.com/jessevdk/go-flags/go.mod new file mode 100644 index 00000000..a626c5d1 --- /dev/null +++ b/backend/vendor/github.com/jessevdk/go-flags/go.mod @@ -0,0 +1,5 @@ +module github.com/jessevdk/go-flags + +go 1.15 + +require golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 diff --git a/backend/vendor/github.com/jessevdk/go-flags/go.sum b/backend/vendor/github.com/jessevdk/go-flags/go.sum new file mode 100644 index 00000000..7503251e --- /dev/null +++ b/backend/vendor/github.com/jessevdk/go-flags/go.sum @@ -0,0 +1,2 @@ +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc= +golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/backend/vendor/github.com/umputun/go-flags/group.go b/backend/vendor/github.com/jessevdk/go-flags/group.go similarity index 98% rename from backend/vendor/github.com/umputun/go-flags/group.go rename to backend/vendor/github.com/jessevdk/go-flags/group.go index ec909e51..181caabb 100644 --- a/backend/vendor/github.com/umputun/go-flags/group.go +++ b/backend/vendor/github.com/jessevdk/go-flags/group.go @@ -73,6 +73,13 @@ func (g *Group) AddGroup(shortDescription string, longDescription string, data i return group, nil } +// AddOption adds a new option to this group. +func (g *Group) AddOption(option *Option, data interface{}) { + option.value = reflect.ValueOf(data) + option.group = g + g.options = append(g.options, option) +} + // Groups returns the list of groups embedded in this group. func (g *Group) Groups() []*Group { return g.groups diff --git a/backend/vendor/github.com/umputun/go-flags/help.go b/backend/vendor/github.com/jessevdk/go-flags/help.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/help.go rename to backend/vendor/github.com/jessevdk/go-flags/help.go diff --git a/backend/vendor/github.com/umputun/go-flags/ini.go b/backend/vendor/github.com/jessevdk/go-flags/ini.go similarity index 94% rename from backend/vendor/github.com/umputun/go-flags/ini.go rename to backend/vendor/github.com/jessevdk/go-flags/ini.go index e714d3d3..60b36c79 100644 --- a/backend/vendor/github.com/umputun/go-flags/ini.go +++ b/backend/vendor/github.com/jessevdk/go-flags/ini.go @@ -325,19 +325,19 @@ func writeCommandIni(command *Command, namespace string, writer io.Writer, optio }) for _, c := range command.commands { - var nns string + var fqn string if c.Hidden { continue } if len(namespace) != 0 { - nns = c.Name + "." + nns + fqn = namespace + "." + c.Name } else { - nns = c.Name + fqn = c.Name } - writeCommandIni(c, nns, writer, options) + writeCommandIni(c, fqn, writer, options) } } @@ -499,13 +499,21 @@ func (i *IniParser) matchingGroups(name string) []*Group { func (i *IniParser) parse(ini *ini) error { p := i.parser + p.eachOption(func(cmd *Command, group *Group, option *Option) { + option.clearReferenceBeforeSet = true + }) + var quotesLookup = make(map[*Option]bool) for name, section := range ini.Sections { groups := i.matchingGroups(name) if len(groups) == 0 { - return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name) + if (p.Options & IgnoreUnknown) == None { + return newErrorf(ErrUnknownGroup, "could not find option group `%s'", name) + } + + continue } for _, inival := range section { @@ -537,9 +545,8 @@ func (i *IniParser) parse(ini *ini) error { continue } - // ini value is ignored if override is set and - // value was previously set from non default - if i.ParseAsDefaults && !opt.isSetDefault { + // ini value is ignored if parsed as default but defaults are prevented + if i.ParseAsDefaults && opt.preventDefault { continue } @@ -572,7 +579,15 @@ func (i *IniParser) parse(ini *ini) error { } } - if err := opt.set(pval); err != nil { + var err error + + if i.ParseAsDefaults { + err = opt.setDefault(pval) + } else { + err = opt.set(pval) + } + + if err != nil { return &IniError{ Message: err.Error(), File: ini.File, @@ -580,6 +595,9 @@ func (i *IniParser) parse(ini *ini) error { } } + // Defaults from ini files take precendence over defaults from parser + opt.preventDefault = true + // either all INI values are quoted or only values who need quoting if _, ok := quotesLookup[opt]; !inival.Quoted || !ok { quotesLookup[opt] = inival.Quoted diff --git a/backend/vendor/github.com/umputun/go-flags/man.go b/backend/vendor/github.com/jessevdk/go-flags/man.go similarity index 76% rename from backend/vendor/github.com/umputun/go-flags/man.go rename to backend/vendor/github.com/jessevdk/go-flags/man.go index 97372b76..82572f9a 100644 --- a/backend/vendor/github.com/umputun/go-flags/man.go +++ b/backend/vendor/github.com/jessevdk/go-flags/man.go @@ -10,30 +10,41 @@ import ( "time" ) +func manQuoteLines(s string) string { + lines := strings.Split(s, "\n") + parts := []string{} + + for _, line := range lines { + parts = append(parts, manQuote(line)) + } + + return strings.Join(parts, "\n") +} + func manQuote(s string) string { return strings.Replace(s, "\\", "\\\\", -1) } -func formatForMan(wr io.Writer, s string) { +func formatForMan(wr io.Writer, s string, quoter func(s string) string) { for { idx := strings.IndexRune(s, '`') if idx < 0 { - fmt.Fprintf(wr, "%s", manQuote(s)) + fmt.Fprintf(wr, "%s", quoter(s)) break } - fmt.Fprintf(wr, "%s", manQuote(s[:idx])) + fmt.Fprintf(wr, "%s", quoter(s[:idx])) s = s[idx+1:] idx = strings.IndexRune(s, '\'') if idx < 0 { - fmt.Fprintf(wr, "%s", manQuote(s)) + fmt.Fprintf(wr, "%s", quoter(s)) break } - fmt.Fprintf(wr, "\\fB%s\\fP", manQuote(s[:idx])) + fmt.Fprintf(wr, "\\fB%s\\fP", quoter(s[:idx])) s = s[idx+1:] } } @@ -50,7 +61,7 @@ func writeManPageOptions(wr io.Writer, grp *Group) { fmt.Fprintf(wr, ".SS %s\n", group.ShortDescription) if group.LongDescription != "" { - formatForMan(wr, group.LongDescription) + formatForMan(wr, group.LongDescription, manQuoteLines) fmt.Fprintln(wr, "") } } @@ -100,14 +111,14 @@ func writeManPageOptions(wr io.Writer, grp *Group) { fmt.Fprintln(wr, "\\fP") if len(opt.Description) != 0 { - formatForMan(wr, opt.Description) + formatForMan(wr, opt.Description, manQuoteLines) fmt.Fprintln(wr, "") } } }) } -func writeManPageSubcommands(wr io.Writer, name string, root *Command) { +func writeManPageSubcommands(wr io.Writer, name string, usagePrefix string, root *Command) { commands := root.sortedVisibleCommands() for _, c := range commands { @@ -123,11 +134,11 @@ func writeManPageSubcommands(wr io.Writer, name string, root *Command) { nn = c.Name } - writeManPageCommand(wr, nn, root, c) + writeManPageCommand(wr, nn, usagePrefix, c) } } -func writeManPageCommand(wr io.Writer, name string, root *Command, command *Command) { +func writeManPageCommand(wr io.Writer, name string, usagePrefix string, command *Command) { fmt.Fprintf(wr, ".SS %s\n", name) fmt.Fprintln(wr, command.ShortDescription) @@ -139,14 +150,16 @@ func writeManPageCommand(wr io.Writer, name string, root *Command, command *Comm if strings.HasPrefix(command.LongDescription, cmdstart) { fmt.Fprintf(wr, "The \\fI%s\\fP command", manQuote(command.Name)) - formatForMan(wr, command.LongDescription[len(cmdstart):]) + formatForMan(wr, command.LongDescription[len(cmdstart):], manQuoteLines) fmt.Fprintln(wr, "") } else { - formatForMan(wr, command.LongDescription) + formatForMan(wr, command.LongDescription, manQuoteLines) fmt.Fprintln(wr, "") } } + var pre = usagePrefix + " " + command.Name + var usage string if us, ok := command.data.(Usage); ok { usage = us.Usage() @@ -154,15 +167,10 @@ func writeManPageCommand(wr io.Writer, name string, root *Command, command *Comm usage = fmt.Sprintf("[%s-OPTIONS]", command.Name) } - var pre string - if root.hasHelpOptions() { - pre = fmt.Sprintf("%s [OPTIONS] %s", root.Name, command.Name) - } else { - pre = fmt.Sprintf("%s %s", root.Name, command.Name) - } - + var nextPrefix = pre if len(usage) > 0 { fmt.Fprintf(wr, "\n\\fBUsage\\fP: %s %s\n.TP\n", manQuote(pre), manQuote(usage)) + nextPrefix = pre + " " + usage } if len(command.Aliases) > 0 { @@ -170,7 +178,7 @@ func writeManPageCommand(wr io.Writer, name string, root *Command, command *Comm } writeManPageOptions(wr, command.Group) - writeManPageSubcommands(wr, name, command) + writeManPageSubcommands(wr, name, nextPrefix, command) } // WriteManPage writes a basic man page in groff format to the specified @@ -188,7 +196,7 @@ func (p *Parser) WriteManPage(wr io.Writer) { fmt.Fprintf(wr, ".TH %s 1 \"%s\"\n", manQuote(p.Name), t.Format("2 January 2006")) fmt.Fprintln(wr, ".SH NAME") - fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuote(p.ShortDescription)) + fmt.Fprintf(wr, "%s \\- %s\n", manQuote(p.Name), manQuoteLines(p.ShortDescription)) fmt.Fprintln(wr, ".SH SYNOPSIS") usage := p.Usage @@ -200,7 +208,7 @@ func (p *Parser) WriteManPage(wr io.Writer) { fmt.Fprintf(wr, "\\fB%s\\fP %s\n", manQuote(p.Name), manQuote(usage)) fmt.Fprintln(wr, ".SH DESCRIPTION") - formatForMan(wr, p.LongDescription) + formatForMan(wr, p.LongDescription, manQuoteLines) fmt.Fprintln(wr, "") fmt.Fprintln(wr, ".SH OPTIONS") @@ -210,6 +218,6 @@ func (p *Parser) WriteManPage(wr io.Writer) { if len(p.visibleCommands()) > 0 { fmt.Fprintln(wr, ".SH COMMANDS") - writeManPageSubcommands(wr, "", p.Command) + writeManPageSubcommands(wr, "", p.Name+" "+usage, p.Command) } } diff --git a/backend/vendor/github.com/umputun/go-flags/multitag.go b/backend/vendor/github.com/jessevdk/go-flags/multitag.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/multitag.go rename to backend/vendor/github.com/jessevdk/go-flags/multitag.go diff --git a/backend/vendor/github.com/umputun/go-flags/option.go b/backend/vendor/github.com/jessevdk/go-flags/option.go similarity index 94% rename from backend/vendor/github.com/umputun/go-flags/option.go rename to backend/vendor/github.com/jessevdk/go-flags/option.go index 5cebb54c..f6d69418 100644 --- a/backend/vendor/github.com/umputun/go-flags/option.go +++ b/backend/vendor/github.com/jessevdk/go-flags/option.go @@ -80,10 +80,11 @@ type Option struct { // Determines if the option will be always quoted in the INI output iniQuote bool - tag multiTag - isSet bool - isSetDefault bool - preventDefault bool + tag multiTag + isSet bool + isSetDefault bool + preventDefault bool + clearReferenceBeforeSet bool defaultLiteral string } @@ -241,12 +242,13 @@ func (option *Option) IsSetDefault() bool { func (option *Option) set(value *string) error { kind := option.value.Type().Kind() - if (kind == reflect.Map || kind == reflect.Slice) && !option.isSet { + if (kind == reflect.Map || kind == reflect.Slice) && option.clearReferenceBeforeSet { option.empty() } option.isSet = true option.preventDefault = true + option.clearReferenceBeforeSet = false if len(option.Choices) != 0 { found := false @@ -280,6 +282,21 @@ func (option *Option) set(value *string) error { return convert("", option.value, option.tag) } +func (option *Option) setDefault(value *string) error { + if option.preventDefault { + return nil + } + + if err := option.set(value); err != nil { + return err + } + + option.isSetDefault = true + option.preventDefault = false + + return nil +} + func (option *Option) showInHelp() bool { return !option.Hidden && (option.ShortName != 0 || len(option.LongName) != 0) } @@ -308,7 +325,11 @@ func (option *Option) empty() { } } -func (option *Option) clearDefault() { +func (option *Option) clearDefault() error { + if option.preventDefault { + return nil + } + usedDefault := option.Default if envKey := option.EnvKeyWithNamespace(); envKey != "" { @@ -327,8 +348,11 @@ func (option *Option) clearDefault() { option.empty() for _, d := range usedDefault { - option.set(&d) - option.isSetDefault = true + err := option.setDefault(&d) + + if err != nil { + return err + } } } else { tp := option.value.Type() @@ -344,6 +368,8 @@ func (option *Option) clearDefault() { } } } + + return nil } func (option *Option) valueIsDefault() bool { diff --git a/backend/vendor/github.com/umputun/go-flags/optstyle_other.go b/backend/vendor/github.com/jessevdk/go-flags/optstyle_other.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/optstyle_other.go rename to backend/vendor/github.com/jessevdk/go-flags/optstyle_other.go diff --git a/backend/vendor/github.com/umputun/go-flags/optstyle_windows.go b/backend/vendor/github.com/jessevdk/go-flags/optstyle_windows.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/optstyle_windows.go rename to backend/vendor/github.com/jessevdk/go-flags/optstyle_windows.go diff --git a/backend/vendor/github.com/umputun/go-flags/parser.go b/backend/vendor/github.com/jessevdk/go-flags/parser.go similarity index 96% rename from backend/vendor/github.com/umputun/go-flags/parser.go rename to backend/vendor/github.com/jessevdk/go-flags/parser.go index a5347b0a..3fc3f7ba 100644 --- a/backend/vendor/github.com/umputun/go-flags/parser.go +++ b/backend/vendor/github.com/jessevdk/go-flags/parser.go @@ -9,6 +9,7 @@ import ( "fmt" "os" "path" + "reflect" "sort" "strings" "unicode/utf8" @@ -207,8 +208,7 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) { } p.eachOption(func(c *Command, g *Group, option *Option) { - option.isSet = false - option.isSetDefault = false + option.clearReferenceBeforeSet = true option.updateDefaultLiteral() }) @@ -310,11 +310,13 @@ func (p *Parser) ParseArgs(args []string) ([]string, error) { if s.err == nil { p.eachOption(func(c *Command, g *Group, option *Option) { - if option.preventDefault { - return + err := option.clearDefault() + if err != nil { + if _, ok := err.(*Error); !ok { + err = p.marshalError(option, err) + } + s.err = err } - - option.clearDefault() }) s.checkRequired(p) @@ -562,16 +564,37 @@ func (p *Parser) parseOption(s *parseState, name string, option *Option, canarg if err != nil { if _, ok := err.(*Error); !ok { - err = newErrorf(ErrMarshal, "invalid argument for flag `%s' (expected %s): %s", - option, - option.value.Type(), - err.Error()) + err = p.marshalError(option, err) } } return err } +func (p *Parser) marshalError(option *Option, err error) *Error { + s := "invalid argument for flag `%s'" + + expected := p.expectedType(option) + + if expected != "" { + s = s + " (expected " + expected + ")" + } + + return newErrorf(ErrMarshal, s+": %s", + option, + err.Error()) +} + +func (p *Parser) expectedType(option *Option) string { + valueType := option.value.Type() + + if valueType.Kind() == reflect.Func { + return "" + } + + return valueType.String() +} + func (p *Parser) parseLong(s *parseState, name string, argument *string) error { if option := s.lookup.longNames[name]; option != nil { // Only long options that are required can consume an argument @@ -689,13 +712,3 @@ func (p *Parser) printError(err error) error { return err } - -func (p *Parser) clearIsSet() { - p.eachCommand(func(c *Command) { - c.eachGroup(func(g *Group) { - for _, option := range g.options { - option.isSet = false - } - }) - }, true) -} diff --git a/backend/vendor/github.com/jessevdk/go-flags/termsize.go b/backend/vendor/github.com/jessevdk/go-flags/termsize.go new file mode 100644 index 00000000..829e477a --- /dev/null +++ b/backend/vendor/github.com/jessevdk/go-flags/termsize.go @@ -0,0 +1,15 @@ +// +build !windows,!plan9,!appengine,!wasm + +package flags + +import ( + "golang.org/x/sys/unix" +) + +func getTerminalColumns() int { + ws, err := unix.IoctlGetWinsize(0, unix.TIOCGWINSZ) + if err != nil { + return 80 + } + return int(ws.Col) +} diff --git a/backend/vendor/github.com/umputun/go-flags/termsize_nosysioctl.go b/backend/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go similarity index 61% rename from backend/vendor/github.com/umputun/go-flags/termsize_nosysioctl.go rename to backend/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go index 12a54580..c1ff1867 100644 --- a/backend/vendor/github.com/umputun/go-flags/termsize_nosysioctl.go +++ b/backend/vendor/github.com/jessevdk/go-flags/termsize_nosysioctl.go @@ -1,4 +1,4 @@ -// +build plan9 solaris appengine wasm +// +build plan9 appengine wasm package flags diff --git a/backend/vendor/github.com/umputun/go-flags/termsize_windows.go b/backend/vendor/github.com/jessevdk/go-flags/termsize_windows.go similarity index 100% rename from backend/vendor/github.com/umputun/go-flags/termsize_windows.go rename to backend/vendor/github.com/jessevdk/go-flags/termsize_windows.go diff --git a/backend/vendor/github.com/klauspost/compress/.goreleaser.yml b/backend/vendor/github.com/klauspost/compress/.goreleaser.yml index c9014ce1..0af08e65 100644 --- a/backend/vendor/github.com/klauspost/compress/.goreleaser.yml +++ b/backend/vendor/github.com/klauspost/compress/.goreleaser.yml @@ -3,6 +3,7 @@ before: hooks: - ./gen.sh + - go install mvdan.cc/garble@latest builds: - @@ -31,6 +32,7 @@ builds: - mips64le goarm: - 7 + gobinary: garble - id: "s2d" binary: s2d @@ -57,6 +59,7 @@ builds: - mips64le goarm: - 7 + gobinary: garble - id: "s2sx" binary: s2sx @@ -84,6 +87,7 @@ builds: - mips64le goarm: - 7 + gobinary: garble archives: - diff --git a/backend/vendor/github.com/klauspost/compress/README.md b/backend/vendor/github.com/klauspost/compress/README.md index 3429879e..e8ff994f 100644 --- a/backend/vendor/github.com/klauspost/compress/README.md +++ b/backend/vendor/github.com/klauspost/compress/README.md @@ -17,6 +17,13 @@ This package provides various compression algorithms. # changelog +* Jan 11, 2022 (v1.14.1) + * s2: Add stream index in [#462](https://github.com/klauspost/compress/pull/462) + * flate: Speed and efficiency improvements in [#439](https://github.com/klauspost/compress/pull/439) [#461](https://github.com/klauspost/compress/pull/461) [#455](https://github.com/klauspost/compress/pull/455) [#452](https://github.com/klauspost/compress/pull/452) [#458](https://github.com/klauspost/compress/pull/458) + * zstd: Performance improvement in [#420]( https://github.com/klauspost/compress/pull/420) [#456](https://github.com/klauspost/compress/pull/456) [#437](https://github.com/klauspost/compress/pull/437) [#467](https://github.com/klauspost/compress/pull/467) [#468](https://github.com/klauspost/compress/pull/468) + * zstd: add arm64 xxhash assembly in [#464](https://github.com/klauspost/compress/pull/464) + * Add garbled for binaries for s2 in [#445](https://github.com/klauspost/compress/pull/445) + * Aug 30, 2021 (v1.13.5) * gz/zlib/flate: Alias stdlib errors [#425](https://github.com/klauspost/compress/pull/425) * s2: Add block support to commandline tools [#413](https://github.com/klauspost/compress/pull/413) @@ -432,6 +439,13 @@ For more information see my blog post on [Fast Linear Time Compression](http://b This is implemented on Go 1.7 as "Huffman Only" mode, though not exposed for gzip. +# Other packages + +Here are other packages of good quality and pure Go (no cgo wrappers or autoconverted code): + +* [github.com/pierrec/lz4](https://github.com/pierrec/lz4) - strong multithreaded LZ4 compression. +* [github.com/cosnicolaou/pbzip2](https://github.com/cosnicolaou/pbzip2) - multithreaded bzip2 decompression. +* [github.com/dsnet/compress](https://github.com/dsnet/compress) - brotli decompression, bzip2 writer. # license diff --git a/backend/vendor/github.com/klauspost/compress/huff0/decompress.go b/backend/vendor/github.com/klauspost/compress/huff0/decompress.go index 9b7cc8e9..2a06bd1a 100644 --- a/backend/vendor/github.com/klauspost/compress/huff0/decompress.go +++ b/backend/vendor/github.com/klauspost/compress/huff0/decompress.go @@ -20,7 +20,7 @@ type dEntrySingle struct { // double-symbols decoding type dEntryDouble struct { - seq uint16 + seq [4]byte nBits uint8 len uint8 } @@ -753,23 +753,21 @@ func (d *Decoder) Decompress4X(dst, src []byte) ([]byte, error) { br[stream2].fillFast() val := br[stream].peekBitsFast(d.actualTableLog) - v := single[val&tlMask] - br[stream].advance(uint8(v.entry)) - buf[off+bufoff*stream] = uint8(v.entry >> 8) - val2 := br[stream2].peekBitsFast(d.actualTableLog) + v := single[val&tlMask] v2 := single[val2&tlMask] + br[stream].advance(uint8(v.entry)) br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream] = uint8(v.entry >> 8) buf[off+bufoff*stream2] = uint8(v2.entry >> 8) val = br[stream].peekBitsFast(d.actualTableLog) - v = single[val&tlMask] - br[stream].advance(uint8(v.entry)) - buf[off+bufoff*stream+1] = uint8(v.entry >> 8) - val2 = br[stream2].peekBitsFast(d.actualTableLog) + v = single[val&tlMask] v2 = single[val2&tlMask] + br[stream].advance(uint8(v.entry)) br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream+1] = uint8(v.entry >> 8) buf[off+bufoff*stream2+1] = uint8(v2.entry >> 8) } @@ -780,23 +778,21 @@ func (d *Decoder) Decompress4X(dst, src []byte) ([]byte, error) { br[stream2].fillFast() val := br[stream].peekBitsFast(d.actualTableLog) - v := single[val&tlMask] - br[stream].advance(uint8(v.entry)) - buf[off+bufoff*stream] = uint8(v.entry >> 8) - val2 := br[stream2].peekBitsFast(d.actualTableLog) + v := single[val&tlMask] v2 := single[val2&tlMask] + br[stream].advance(uint8(v.entry)) br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream] = uint8(v.entry >> 8) buf[off+bufoff*stream2] = uint8(v2.entry >> 8) val = br[stream].peekBitsFast(d.actualTableLog) - v = single[val&tlMask] - br[stream].advance(uint8(v.entry)) - buf[off+bufoff*stream+1] = uint8(v.entry >> 8) - val2 = br[stream2].peekBitsFast(d.actualTableLog) + v = single[val&tlMask] v2 = single[val2&tlMask] + br[stream].advance(uint8(v.entry)) br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream+1] = uint8(v.entry >> 8) buf[off+bufoff*stream2+1] = uint8(v2.entry >> 8) } @@ -914,7 +910,7 @@ func (d *Decoder) decompress4X8bit(dst, src []byte) ([]byte, error) { out := dst dstEvery := (dstSize + 3) / 4 - shift := (8 - d.actualTableLog) & 7 + shift := (56 + (8 - d.actualTableLog)) & 63 const tlSize = 1 << 8 single := d.dt.single[:tlSize] @@ -935,79 +931,91 @@ func (d *Decoder) decompress4X8bit(dst, src []byte) ([]byte, error) { // Interleave 2 decodes. const stream = 0 const stream2 = 1 - br[stream].fillFast() - br[stream2].fillFast() + br1 := &br[stream] + br2 := &br[stream2] + br1.fillFast() + br2.fillFast() - v := single[br[stream].peekByteFast()>>shift].entry + v := single[uint8(br1.value>>shift)].entry + v2 := single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 := single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream+1] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+1] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream+2] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry - buf[off+bufoff*stream+3] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream2+3] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) + buf[off+bufoff*stream+3] = uint8(v >> 8) } { const stream = 2 const stream2 = 3 - br[stream].fillFast() - br[stream2].fillFast() + br1 := &br[stream] + br2 := &br[stream2] + br1.fillFast() + br2.fillFast() - v := single[br[stream].peekByteFast()>>shift].entry + v := single[uint8(br1.value>>shift)].entry + v2 := single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 := single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream+1] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+1] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream+2] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry - buf[off+bufoff*stream+3] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry + v = single[uint8(br1.value>>shift)].entry + v2 = single[uint8(br2.value>>shift)].entry + br1.bitsRead += uint8(v) + br1.value <<= v & 63 + br2.bitsRead += uint8(v2) + br2.value <<= v2 & 63 buf[off+bufoff*stream2+3] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) + buf[off+bufoff*stream+3] = uint8(v >> 8) } off += 4 @@ -1073,7 +1081,7 @@ func (d *Decoder) decompress4X8bit(dst, src []byte) ([]byte, error) { } // Read value and increment offset. - v := single[br.peekByteFast()>>shift].entry + v := single[uint8(br.value>>shift)].entry nBits := uint8(v) br.advance(nBits) bitsLeft -= int(nBits) @@ -1121,7 +1129,7 @@ func (d *Decoder) decompress4X8bitExactly(dst, src []byte) ([]byte, error) { out := dst dstEvery := (dstSize + 3) / 4 - const shift = 0 + const shift = 56 const tlSize = 1 << 8 const tlMask = tlSize - 1 single := d.dt.single[:tlSize] @@ -1145,37 +1153,41 @@ func (d *Decoder) decompress4X8bitExactly(dst, src []byte) ([]byte, error) { br[stream].fillFast() br[stream2].fillFast() - v := single[br[stream].peekByteFast()>>shift].entry + v := single[uint8(br[stream].value>>shift)].entry + v2 := single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 := single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+1] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+1] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+2] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+3] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+3] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) } { @@ -1184,37 +1196,41 @@ func (d *Decoder) decompress4X8bitExactly(dst, src []byte) ([]byte, error) { br[stream].fillFast() br[stream2].fillFast() - v := single[br[stream].peekByteFast()>>shift].entry + v := single[uint8(br[stream].value>>shift)].entry + v2 := single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 := single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+1] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+1] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+2] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+2] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) - v = single[br[stream].peekByteFast()>>shift].entry + v = single[uint8(br[stream].value>>shift)].entry + v2 = single[uint8(br[stream2].value>>shift)].entry + br[stream].bitsRead += uint8(v) + br[stream].value <<= v & 63 + br[stream2].bitsRead += uint8(v2) + br[stream2].value <<= v2 & 63 buf[off+bufoff*stream+3] = uint8(v >> 8) - br[stream].advance(uint8(v)) - - v2 = single[br[stream2].peekByteFast()>>shift].entry buf[off+bufoff*stream2+3] = uint8(v2 >> 8) - br[stream2].advance(uint8(v2)) } off += 4 @@ -1280,7 +1296,7 @@ func (d *Decoder) decompress4X8bitExactly(dst, src []byte) ([]byte, error) { } // Read value and increment offset. - v := single[br.peekByteFast()>>shift].entry + v := single[br.peekByteFast()].entry nBits := uint8(v) br.advance(nBits) bitsLeft -= int(nBits) diff --git a/backend/vendor/github.com/klauspost/compress/zstd/bitreader.go b/backend/vendor/github.com/klauspost/compress/zstd/bitreader.go index 85445853..753d17df 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/bitreader.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/bitreader.go @@ -50,16 +50,23 @@ func (b *bitReader) getBits(n uint8) int { if n == 0 /*|| b.bitsRead >= 64 */ { return 0 } - return b.getBitsFast(n) + return int(b.get32BitsFast(n)) } -// getBitsFast requires that at least one bit is requested every time. +// get32BitsFast requires that at least one bit is requested every time. // There are no checks if the buffer is filled. -func (b *bitReader) getBitsFast(n uint8) int { +func (b *bitReader) get32BitsFast(n uint8) uint32 { const regMask = 64 - 1 v := uint32((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask)) b.bitsRead += n - return int(v) + return v +} + +func (b *bitReader) get16BitsFast(n uint8) uint16 { + const regMask = 64 - 1 + v := uint16((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask)) + b.bitsRead += n + return v } // fillFast() will make sure at least 32 bits are available. diff --git a/backend/vendor/github.com/klauspost/compress/zstd/bitwriter.go b/backend/vendor/github.com/klauspost/compress/zstd/bitwriter.go index 303ae90f..b3661828 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/bitwriter.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/bitwriter.go @@ -38,7 +38,7 @@ func (b *bitWriter) addBits16NC(value uint16, bits uint8) { b.nBits += bits } -// addBits32NC will add up to 32 bits. +// addBits32NC will add up to 31 bits. // It will not check if there is space for them, // so the caller must ensure that it has flushed recently. func (b *bitWriter) addBits32NC(value uint32, bits uint8) { @@ -46,6 +46,26 @@ func (b *bitWriter) addBits32NC(value uint32, bits uint8) { b.nBits += bits } +// addBits64NC will add up to 64 bits. +// There must be space for 32 bits. +func (b *bitWriter) addBits64NC(value uint64, bits uint8) { + if bits <= 31 { + b.addBits32Clean(uint32(value), bits) + return + } + b.addBits32Clean(uint32(value), 32) + b.flush32() + b.addBits32Clean(uint32(value>>32), bits-32) +} + +// addBits32Clean will add up to 32 bits. +// It will not check if there is space for them. +// The input must not contain more bits than specified. +func (b *bitWriter) addBits32Clean(value uint32, bits uint8) { + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + // addBits16Clean will add up to 16 bits. value may not contain more set bits than indicated. // It will not check if there is space for them, so the caller must ensure that it has flushed recently. func (b *bitWriter) addBits16Clean(value uint16, bits uint8) { diff --git a/backend/vendor/github.com/klauspost/compress/zstd/blockdec.go b/backend/vendor/github.com/klauspost/compress/zstd/blockdec.go index 8a98c456..dc587b2c 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/blockdec.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/blockdec.go @@ -76,12 +76,11 @@ type blockDec struct { // Window size of the block. WindowSize uint64 - history chan *history - input chan struct{} - result chan decodeOutput - sequenceBuf []seq - err error - decWG sync.WaitGroup + history chan *history + input chan struct{} + result chan decodeOutput + err error + decWG sync.WaitGroup // Frame to use for singlethreaded decoding. // Should not be used by the decoder itself since parent may be another frame. @@ -512,18 +511,7 @@ func (b *blockDec) decodeCompressed(hist *history) error { nSeqs = 0x7f00 + int(in[1]) + (int(in[2]) << 8) in = in[3:] } - // Allocate sequences - if cap(b.sequenceBuf) < nSeqs { - if b.lowMem { - b.sequenceBuf = make([]seq, nSeqs) - } else { - // Allocate max - b.sequenceBuf = make([]seq, nSeqs, maxSequences) - } - } else { - // Reuse buffer - b.sequenceBuf = b.sequenceBuf[:nSeqs] - } + var seqs = &sequenceDecs{} if nSeqs > 0 { if len(in) < 1 { diff --git a/backend/vendor/github.com/klauspost/compress/zstd/blockenc.go b/backend/vendor/github.com/klauspost/compress/zstd/blockenc.go index 3df185ee..12e8f6f0 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/blockenc.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/blockenc.go @@ -51,7 +51,7 @@ func (b *blockEnc) init() { if cap(b.literals) < maxCompressedBlockSize { b.literals = make([]byte, 0, maxCompressedBlockSize) } - const defSeqs = 200 + const defSeqs = 2000 if cap(b.sequences) < defSeqs { b.sequences = make([]seq, 0, defSeqs) } @@ -426,7 +426,7 @@ func fuzzFseEncoder(data []byte) int { return 0 } enc := fseEncoder{} - hist := enc.Histogram()[:256] + hist := enc.Histogram() maxSym := uint8(0) for i, v := range data { v = v & 63 @@ -722,52 +722,53 @@ func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error { println("Encoded seq", seq, s, "codes:", s.llCode, s.mlCode, s.ofCode, "states:", ll.state, ml.state, of.state, "bits:", llB, mlB, ofB) } seq-- - if llEnc.maxBits+mlEnc.maxBits+ofEnc.maxBits <= 32 { - // No need to flush (common) - for seq >= 0 { - s = b.sequences[seq] - wr.flush32() - llB, ofB, mlB := llTT[s.llCode], ofTT[s.ofCode], mlTT[s.mlCode] - // tabelog max is 8 for all. - of.encode(ofB) - ml.encode(mlB) - ll.encode(llB) - wr.flush32() + // Store sequences in reverse... + for seq >= 0 { + s = b.sequences[seq] - // We checked that all can stay within 32 bits - wr.addBits32NC(s.litLen, llB.outBits) - wr.addBits32NC(s.matchLen, mlB.outBits) - wr.addBits32NC(s.offset, ofB.outBits) + ofB := ofTT[s.ofCode] + wr.flush32() // tablelog max is below 8 for each, so it will fill max 24 bits. + //of.encode(ofB) + nbBitsOut := (uint32(of.state) + ofB.deltaNbBits) >> 16 + dstState := int32(of.state>>(nbBitsOut&15)) + int32(ofB.deltaFindState) + wr.addBits16NC(of.state, uint8(nbBitsOut)) + of.state = of.stateTable[dstState] - if debugSequences { - println("Encoded seq", seq, s) - } + // Accumulate extra bits. + outBits := ofB.outBits & 31 + extraBits := uint64(s.offset & bitMask32[outBits]) + extraBitsN := outBits - seq-- + mlB := mlTT[s.mlCode] + //ml.encode(mlB) + nbBitsOut = (uint32(ml.state) + mlB.deltaNbBits) >> 16 + dstState = int32(ml.state>>(nbBitsOut&15)) + int32(mlB.deltaFindState) + wr.addBits16NC(ml.state, uint8(nbBitsOut)) + ml.state = ml.stateTable[dstState] + + outBits = mlB.outBits & 31 + extraBits = extraBits<> 16 + dstState = int32(ll.state>>(nbBitsOut&15)) + int32(llB.deltaFindState) + wr.addBits16NC(ll.state, uint8(nbBitsOut)) + ll.state = ll.stateTable[dstState] + + outBits = llB.outBits & 31 + extraBits = extraBits<= 0 { - s = b.sequences[seq] - wr.flush32() - llB, ofB, mlB := llTT[s.llCode], ofTT[s.ofCode], mlTT[s.mlCode] - // tabelog max is below 8 for each. - of.encode(ofB) - ml.encode(mlB) - ll.encode(llB) - wr.flush32() - // ml+ll = max 32 bits total - wr.addBits32NC(s.litLen, llB.outBits) - wr.addBits32NC(s.matchLen, mlB.outBits) - wr.flush32() - wr.addBits32NC(s.offset, ofB.outBits) - - if debugSequences { - println("Encoded seq", seq, s) - } - - seq-- - } + seq-- } ml.flush(mlEnc.actualTableLog) of.flush(ofEnc.actualTableLog) @@ -801,14 +802,13 @@ func (b *blockEnc) genCodes() { // nothing to do return } - if len(b.sequences) > math.MaxUint16 { panic("can only encode up to 64K sequences") } // No bounds checks after here: - llH := b.coders.llEnc.Histogram()[:256] - ofH := b.coders.ofEnc.Histogram()[:256] - mlH := b.coders.mlEnc.Histogram()[:256] + llH := b.coders.llEnc.Histogram() + ofH := b.coders.ofEnc.Histogram() + mlH := b.coders.mlEnc.Histogram() for i := range llH { llH[i] = 0 } @@ -820,7 +820,8 @@ func (b *blockEnc) genCodes() { } var llMax, ofMax, mlMax uint8 - for i, seq := range b.sequences { + for i := range b.sequences { + seq := &b.sequences[i] v := llCode(seq.litLen) seq.llCode = v llH[v]++ @@ -844,7 +845,6 @@ func (b *blockEnc) genCodes() { panic(fmt.Errorf("mlMax > maxMatchLengthSymbol (%d), matchlen: %d", mlMax, seq.matchLen)) } } - b.sequences[i] = seq } maxCount := func(a []uint32) int { var max uint32 diff --git a/backend/vendor/github.com/klauspost/compress/zstd/decodeheader.go b/backend/vendor/github.com/klauspost/compress/zstd/decodeheader.go index 69736e8d..5022e71c 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/decodeheader.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/decodeheader.go @@ -5,6 +5,7 @@ package zstd import ( "bytes" + "encoding/binary" "errors" "io" ) @@ -15,18 +16,50 @@ const HeaderMaxSize = 14 + 3 // Header contains information about the first frame and block within that. type Header struct { - // Window Size the window of data to keep while decoding. - // Will only be set if HasFCS is false. - WindowSize uint64 + // SingleSegment specifies whether the data is to be decompressed into a + // single contiguous memory segment. + // It implies that WindowSize is invalid and that FrameContentSize is valid. + SingleSegment bool - // Frame content size. - // Expected size of the entire frame. - FrameContentSize uint64 + // WindowSize is the window of data to keep while decoding. + // Will only be set if SingleSegment is false. + WindowSize uint64 // Dictionary ID. // If 0, no dictionary. DictionaryID uint32 + // HasFCS specifies whether FrameContentSize has a valid value. + HasFCS bool + + // FrameContentSize is the expected uncompressed size of the entire frame. + FrameContentSize uint64 + + // Skippable will be true if the frame is meant to be skipped. + // This implies that FirstBlock.OK is false. + Skippable bool + + // SkippableID is the user-specific ID for the skippable frame. + // Valid values are between 0 to 15, inclusive. + SkippableID int + + // SkippableSize is the length of the user data to skip following + // the header. + SkippableSize uint32 + + // HeaderSize is the raw size of the frame header. + // + // For normal frames, it includes the size of the magic number and + // the size of the header (per section 3.1.1.1). + // It does not include the size for any data blocks (section 3.1.1.2) nor + // the size for the trailing content checksum. + // + // For skippable frames, this counts the size of the magic number + // along with the size of the size field of the payload. + // It does not include the size of the skippable payload itself. + // The total frame size is the HeaderSize plus the SkippableSize. + HeaderSize int + // First block information. FirstBlock struct { // OK will be set if first block could be decoded. @@ -51,17 +84,9 @@ type Header struct { CompressedSize int } - // Skippable will be true if the frame is meant to be skipped. - // No other information will be populated. - Skippable bool - // If set there is a checksum present for the block content. + // The checksum field at the end is always 4 bytes long. HasCheckSum bool - - // If this is true FrameContentSize will have a valid value - HasFCS bool - - SingleSegment bool } // Decode the header from the beginning of the stream. @@ -71,39 +96,46 @@ type Header struct { // If there isn't enough input, io.ErrUnexpectedEOF is returned. // The FirstBlock.OK will indicate if enough information was available to decode the first block header. func (h *Header) Decode(in []byte) error { + *h = Header{} if len(in) < 4 { return io.ErrUnexpectedEOF } + h.HeaderSize += 4 b, in := in[:4], in[4:] if !bytes.Equal(b, frameMagic) { if !bytes.Equal(b[1:4], skippableFrameMagic) || b[0]&0xf0 != 0x50 { return ErrMagicMismatch } - *h = Header{Skippable: true} + if len(in) < 4 { + return io.ErrUnexpectedEOF + } + h.HeaderSize += 4 + h.Skippable = true + h.SkippableID = int(b[0] & 0xf) + h.SkippableSize = binary.LittleEndian.Uint32(in) return nil } - if len(in) < 1 { - return io.ErrUnexpectedEOF - } - - // Clear output - *h = Header{} - fhd, in := in[0], in[1:] - h.SingleSegment = fhd&(1<<5) != 0 - h.HasCheckSum = fhd&(1<<2) != 0 - - if fhd&(1<<3) != 0 { - return errors.New("reserved bit set on frame header") - } // Read Window_Descriptor // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#window_descriptor + if len(in) < 1 { + return io.ErrUnexpectedEOF + } + fhd, in := in[0], in[1:] + h.HeaderSize++ + h.SingleSegment = fhd&(1<<5) != 0 + h.HasCheckSum = fhd&(1<<2) != 0 + if fhd&(1<<3) != 0 { + return errors.New("reserved bit set on frame header") + } + if !h.SingleSegment { if len(in) < 1 { return io.ErrUnexpectedEOF } var wd byte wd, in = in[0], in[1:] + h.HeaderSize++ windowLog := 10 + (wd >> 3) windowBase := uint64(1) << windowLog windowAdd := (windowBase / 8) * uint64(wd&0x7) @@ -120,9 +152,7 @@ func (h *Header) Decode(in []byte) error { return io.ErrUnexpectedEOF } b, in = in[:size], in[size:] - if b == nil { - return io.ErrUnexpectedEOF - } + h.HeaderSize += int(size) switch size { case 1: h.DictionaryID = uint32(b[0]) @@ -152,9 +182,7 @@ func (h *Header) Decode(in []byte) error { return io.ErrUnexpectedEOF } b, in = in[:fcsSize], in[fcsSize:] - if b == nil { - return io.ErrUnexpectedEOF - } + h.HeaderSize += int(fcsSize) switch fcsSize { case 1: h.FrameContentSize = uint64(b[0]) diff --git a/backend/vendor/github.com/klauspost/compress/zstd/enc_base.go b/backend/vendor/github.com/klauspost/compress/zstd/enc_base.go index 295cd602..15ae8ee8 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/enc_base.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/enc_base.go @@ -108,11 +108,6 @@ func (e *fastBase) UseBlock(enc *blockEnc) { e.blk = enc } -func (e *fastBase) matchlenNoHist(s, t int32, src []byte) int32 { - // Extend the match to be as long as possible. - return int32(matchLen(src[s:], src[t:])) -} - func (e *fastBase) matchlen(s, t int32, src []byte) int32 { if debugAsserts { if s < 0 { @@ -131,9 +126,24 @@ func (e *fastBase) matchlen(s, t int32, src []byte) int32 { panic(fmt.Sprintf("len(src)-s (%d) > maxCompressedBlockSize (%d)", len(src)-int(s), maxCompressedBlockSize)) } } + a := src[s:] + b := src[t:] + b = b[:len(a)] + end := int32((len(a) >> 3) << 3) + for i := int32(0); i < end; i += 8 { + if diff := load6432(a, i) ^ load6432(b, i); diff != 0 { + return i + int32(bits.TrailingZeros64(diff)>>3) + } + } - // Extend the match to be as long as possible. - return int32(matchLen(src[s:], src[t:])) + a = a[end:] + b = b[end:] + for i := range a { + if a[i] != b[i] { + return int32(i) + end + } + } + return int32(len(a)) + end } // Reset the encoding table. diff --git a/backend/vendor/github.com/klauspost/compress/zstd/enc_fast.go b/backend/vendor/github.com/klauspost/compress/zstd/enc_fast.go index f2502629..5f08a283 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/enc_fast.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/enc_fast.go @@ -6,8 +6,6 @@ package zstd import ( "fmt" - "math" - "math/bits" ) const ( @@ -136,20 +134,7 @@ encodeLoop: // Consider history as well. var seq seq var length int32 - // length = 4 + e.matchlen(s+6, repIndex+4, src) - { - a := src[s+6:] - b := src[repIndex+4:] - endI := len(a) & (math.MaxInt32 - 7) - length = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - length = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } - + length = 4 + e.matchlen(s+6, repIndex+4, src) seq.matchLen = uint32(length - zstdMinMatch) // We might be able to match backwards. @@ -236,20 +221,7 @@ encodeLoop: } // Extend the 4-byte match as long as possible. - //l := e.matchlen(s+4, t+4, src) + 4 - var l int32 - { - a := src[s+4:] - b := src[t+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := e.matchlen(s+4, t+4, src) + 4 // Extend backwards tMin := s - e.maxMatchOff @@ -286,20 +258,7 @@ encodeLoop: if o2 := s - offset2; canRepeat && load3232(src, o2) == uint32(cv) { // We have at least 4 byte match. // No need to check backwards. We come straight from a match - //l := 4 + e.matchlen(s+4, o2+4, src) - var l int32 - { - a := src[s+4:] - b := src[o2+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := 4 + e.matchlen(s+4, o2+4, src) // Store this, since we have it. nextHash := hashLen(cv, hashLog, tableFastHashLen) @@ -418,21 +377,7 @@ encodeLoop: if len(blk.sequences) > 2 && load3232(src, repIndex) == uint32(cv>>16) { // Consider history as well. var seq seq - // length := 4 + e.matchlen(s+6, repIndex+4, src) - // length := 4 + int32(matchLen(src[s+6:], src[repIndex+4:])) - var length int32 - { - a := src[s+6:] - b := src[repIndex+4:] - endI := len(a) & (math.MaxInt32 - 7) - length = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - length = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + length := 4 + e.matchlen(s+6, repIndex+4, src) seq.matchLen = uint32(length - zstdMinMatch) @@ -522,21 +467,7 @@ encodeLoop: panic(fmt.Sprintf("t (%d) < 0 ", t)) } // Extend the 4-byte match as long as possible. - //l := e.matchlenNoHist(s+4, t+4, src) + 4 - // l := int32(matchLen(src[s+4:], src[t+4:])) + 4 - var l int32 - { - a := src[s+4:] - b := src[t+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := e.matchlen(s+4, t+4, src) + 4 // Extend backwards tMin := s - e.maxMatchOff @@ -573,21 +504,7 @@ encodeLoop: if o2 := s - offset2; len(blk.sequences) > 2 && load3232(src, o2) == uint32(cv) { // We have at least 4 byte match. // No need to check backwards. We come straight from a match - //l := 4 + e.matchlenNoHist(s+4, o2+4, src) - // l := 4 + int32(matchLen(src[s+4:], src[o2+4:])) - var l int32 - { - a := src[s+4:] - b := src[o2+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := 4 + e.matchlen(s+4, o2+4, src) // Store this, since we have it. nextHash := hashLen(cv, hashLog, tableFastHashLen) @@ -731,19 +648,7 @@ encodeLoop: // Consider history as well. var seq seq var length int32 - // length = 4 + e.matchlen(s+6, repIndex+4, src) - { - a := src[s+6:] - b := src[repIndex+4:] - endI := len(a) & (math.MaxInt32 - 7) - length = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - length = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + length = 4 + e.matchlen(s+6, repIndex+4, src) seq.matchLen = uint32(length - zstdMinMatch) @@ -831,20 +736,7 @@ encodeLoop: } // Extend the 4-byte match as long as possible. - //l := e.matchlen(s+4, t+4, src) + 4 - var l int32 - { - a := src[s+4:] - b := src[t+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := e.matchlen(s+4, t+4, src) + 4 // Extend backwards tMin := s - e.maxMatchOff @@ -881,20 +773,7 @@ encodeLoop: if o2 := s - offset2; canRepeat && load3232(src, o2) == uint32(cv) { // We have at least 4 byte match. // No need to check backwards. We come straight from a match - //l := 4 + e.matchlen(s+4, o2+4, src) - var l int32 - { - a := src[s+4:] - b := src[o2+4:] - endI := len(a) & (math.MaxInt32 - 7) - l = int32(endI) + 4 - for i := 0; i < endI; i += 8 { - if diff := load64(a, i) ^ load64(b, i); diff != 0 { - l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 - break - } - } - } + l := 4 + e.matchlen(s+4, o2+4, src) // Store this, since we have it. nextHash := hashLen(cv, hashLog, tableFastHashLen) diff --git a/backend/vendor/github.com/klauspost/compress/zstd/encoder_options.go b/backend/vendor/github.com/klauspost/compress/zstd/encoder_options.go index 7d29e1d6..5f2e1d02 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/encoder_options.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/encoder_options.go @@ -24,6 +24,7 @@ type encoderOptions struct { allLitEntropy bool customWindow bool customALEntropy bool + customBlockSize bool lowMem bool dict *dict } @@ -33,7 +34,7 @@ func (o *encoderOptions) setDefault() { concurrent: runtime.GOMAXPROCS(0), crc: true, single: nil, - blockSize: 1 << 16, + blockSize: maxCompressedBlockSize, windowSize: 8 << 20, level: SpeedDefault, allLitEntropy: true, @@ -106,6 +107,7 @@ func WithWindowSize(n int) EOption { o.customWindow = true if o.blockSize > o.windowSize { o.blockSize = o.windowSize + o.customBlockSize = true } return nil } @@ -188,10 +190,9 @@ func EncoderLevelFromZstd(level int) EncoderLevel { return SpeedDefault case level >= 6 && level < 10: return SpeedBetterCompression - case level >= 10: + default: return SpeedBestCompression } - return SpeedDefault } // String provides a string representation of the compression level. @@ -222,6 +223,9 @@ func WithEncoderLevel(l EncoderLevel) EOption { switch o.level { case SpeedFastest: o.windowSize = 4 << 20 + if !o.customBlockSize { + o.blockSize = 1 << 16 + } case SpeedDefault: o.windowSize = 8 << 20 case SpeedBetterCompression: diff --git a/backend/vendor/github.com/klauspost/compress/zstd/fse_decoder.go b/backend/vendor/github.com/klauspost/compress/zstd/fse_decoder.go index e6d3d49b..bb3d4fd6 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/fse_decoder.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/fse_decoder.go @@ -379,7 +379,7 @@ func (s decSymbol) final() (int, uint8) { // This can only be used if no symbols are 0 bits. // At least tablelog bits must be available in the bit reader. func (s *fseState) nextFast(br *bitReader) (uint32, uint8) { - lowBits := uint16(br.getBitsFast(s.state.nbBits())) + lowBits := br.get16BitsFast(s.state.nbBits()) s.state = s.dt[s.state.newState()+lowBits] return s.state.baseline(), s.state.addBits() } diff --git a/backend/vendor/github.com/klauspost/compress/zstd/fse_encoder.go b/backend/vendor/github.com/klauspost/compress/zstd/fse_encoder.go index b4757ee3..5442061b 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/fse_encoder.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/fse_encoder.go @@ -62,9 +62,8 @@ func (s symbolTransform) String() string { // To indicate that you have populated the histogram call HistogramFinished // with the value of the highest populated symbol, as well as the number of entries // in the most populated entry. These are accepted at face value. -// The returned slice will always be length 256. -func (s *fseEncoder) Histogram() []uint32 { - return s.count[:] +func (s *fseEncoder) Histogram() *[256]uint32 { + return &s.count } // HistogramFinished can be called to indicate that the histogram has been populated. diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s index be8db5bf..cea17856 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s @@ -1,6 +1,7 @@ // +build !appengine // +build gc // +build !purego +// +build !noasm #include "textflag.h" diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s new file mode 100644 index 00000000..4d64a17d --- /dev/null +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_arm64.s @@ -0,0 +1,186 @@ +// +build gc,!purego,!noasm + +#include "textflag.h" + +// Register allocation. +#define digest R1 +#define h R2 // Return value. +#define p R3 // Input pointer. +#define len R4 +#define nblocks R5 // len / 32. +#define prime1 R7 +#define prime2 R8 +#define prime3 R9 +#define prime4 R10 +#define prime5 R11 +#define v1 R12 +#define v2 R13 +#define v3 R14 +#define v4 R15 +#define x1 R20 +#define x2 R21 +#define x3 R22 +#define x4 R23 + +#define round(acc, x) \ + MADD prime2, acc, x, acc \ + ROR $64-31, acc \ + MUL prime1, acc \ + +// x = round(0, x). +#define round0(x) \ + MUL prime2, x \ + ROR $64-31, x \ + MUL prime1, x \ + +#define mergeRound(x) \ + round0(x) \ + EOR x, h \ + MADD h, prime4, prime1, h \ + +// Update v[1-4] with 32-byte blocks. Assumes len >= 32. +#define blocksLoop() \ + LSR $5, len, nblocks \ + PCALIGN $16 \ + loop: \ + LDP.P 32(p), (x1, x2) \ + round(v1, x1) \ + LDP -16(p), (x3, x4) \ + round(v2, x2) \ + SUB $1, nblocks \ + round(v3, x3) \ + round(v4, x4) \ + CBNZ nblocks, loop \ + +// The primes are repeated here to ensure that they're stored +// in a contiguous array, so we can load them with LDP. +DATA primes<> +0(SB)/8, $11400714785074694791 +DATA primes<> +8(SB)/8, $14029467366897019727 +DATA primes<>+16(SB)/8, $1609587929392839161 +DATA primes<>+24(SB)/8, $9650029242287828579 +DATA primes<>+32(SB)/8, $2870177450012600261 +GLOBL primes<>(SB), NOPTR+RODATA, $40 + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOFRAME+NOSPLIT, $0-32 + LDP b_base+0(FP), (p, len) + + LDP primes<> +0(SB), (prime1, prime2) + LDP primes<>+16(SB), (prime3, prime4) + MOVD primes<>+32(SB), prime5 + + CMP $32, len + CSEL LO, prime5, ZR, h // if len < 32 { h = prime5 } else { h = 0 } + BLO afterLoop + + ADD prime1, prime2, v1 + MOVD prime2, v2 + MOVD $0, v3 + NEG prime1, v4 + + blocksLoop() + + ROR $64-1, v1, x1 + ROR $64-7, v2, x2 + ADD x1, x2 + ROR $64-12, v3, x3 + ROR $64-18, v4, x4 + ADD x3, x4 + ADD x2, x4, h + + mergeRound(v1) + mergeRound(v2) + mergeRound(v3) + mergeRound(v4) + +afterLoop: + ADD len, h + + TBZ $4, len, try8 + LDP.P 16(p), (x1, x2) + + round0(x1) + ROR $64-27, h + EOR x1 @> 64-27, h, h + MADD h, prime4, prime1, h + + round0(x2) + ROR $64-27, h + EOR x2 @> 64-27, h + MADD h, prime4, prime1, h + +try8: + TBZ $3, len, try4 + MOVD.P 8(p), x1 + + round0(x1) + ROR $64-27, h + EOR x1 @> 64-27, h + MADD h, prime4, prime1, h + +try4: + TBZ $2, len, try2 + MOVWU.P 4(p), x2 + + MUL prime1, x2 + ROR $64-23, h + EOR x2 @> 64-23, h + MADD h, prime3, prime2, h + +try2: + TBZ $1, len, try1 + MOVHU.P 2(p), x3 + AND $255, x3, x1 + LSR $8, x3, x2 + + MUL prime5, x1 + ROR $64-11, h + EOR x1 @> 64-11, h + MUL prime1, h + + MUL prime5, x2 + ROR $64-11, h + EOR x2 @> 64-11, h + MUL prime1, h + +try1: + TBZ $0, len, end + MOVBU (p), x4 + + MUL prime5, x4 + ROR $64-11, h + EOR x4 @> 64-11, h + MUL prime1, h + +end: + EOR h >> 33, h + MUL prime2, h + EOR h >> 29, h + MUL prime3, h + EOR h >> 32, h + + MOVD h, ret+24(FP) + RET + +// func writeBlocks(d *Digest, b []byte) int +// +// Assumes len(b) >= 32. +TEXT ·writeBlocks(SB), NOFRAME+NOSPLIT, $0-40 + LDP primes<>(SB), (prime1, prime2) + + // Load state. Assume v[1-4] are stored contiguously. + MOVD d+0(FP), digest + LDP 0(digest), (v1, v2) + LDP 16(digest), (v3, v4) + + LDP b_base+8(FP), (p, len) + + blocksLoop() + + // Store updated state. + STP (v1, v2), 0(digest) + STP (v3, v4), 16(digest) + + BIC $31, len + MOVD len, ret+32(FP) + RET diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go similarity index 51% rename from backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go rename to backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go index 0ae847f7..1a1fac9c 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_asm.go @@ -1,5 +1,9 @@ -//go:build !appengine && gc && !purego -// +build !appengine,gc,!purego +//go:build (amd64 || arm64) && !appengine && gc && !purego && !noasm +// +build amd64 arm64 +// +build !appengine +// +build gc +// +build !purego +// +build !noasm package xxhash diff --git a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go index 1f52f296..209cb4a9 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go @@ -1,5 +1,5 @@ -//go:build !amd64 || appengine || !gc || purego -// +build !amd64 appengine !gc purego +//go:build (!amd64 && !arm64) || appengine || !gc || purego || noasm +// +build !amd64,!arm64 appengine !gc purego noasm package xxhash diff --git a/backend/vendor/github.com/klauspost/compress/zstd/seqdec.go b/backend/vendor/github.com/klauspost/compress/zstd/seqdec.go index 1dd39e63..bc731e4c 100644 --- a/backend/vendor/github.com/klauspost/compress/zstd/seqdec.go +++ b/backend/vendor/github.com/klauspost/compress/zstd/seqdec.go @@ -278,7 +278,7 @@ func (s *sequenceDecs) decode(seqs int, br *bitReader, hist []byte) error { mlState = mlTable[mlState.newState()&maxTableMask] ofState = ofTable[ofState.newState()&maxTableMask] } else { - bits := br.getBitsFast(nBits) + bits := br.get32BitsFast(nBits) lowBits := uint16(bits >> ((ofState.nbBits() + mlState.nbBits()) & 31)) llState = llTable[(llState.newState()+lowBits)&maxTableMask] @@ -326,7 +326,7 @@ func (s *sequenceDecs) updateAlt(br *bitReader) { s.offsets.state.state = s.offsets.state.dt[c.newState()] return } - bits := br.getBitsFast(nBits) + bits := br.get32BitsFast(nBits) lowBits := uint16(bits >> ((c.nbBits() + b.nbBits()) & 31)) s.litLengths.state.state = s.litLengths.state.dt[a.newState()+lowBits] diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/helpers.go b/backend/vendor/github.com/microcosm-cc/bluemonday/helpers.go index 776a4a6c..4e31fb6f 100644 --- a/backend/vendor/github.com/microcosm-cc/bluemonday/helpers.go +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/helpers.go @@ -295,3 +295,9 @@ func (p *Policy) AllowTables() { CellVerticalAlign, ).OnElements("tbody", "tfoot") } + +func (p *Policy) AllowIFrames(vals ...SandboxValue) { + p.AllowAttrs("sandbox").OnElements("iframe") + + p.RequireSandboxOnIFrame(vals...) +} diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/policy.go b/backend/vendor/github.com/microcosm-cc/bluemonday/policy.go index 71f6b8db..8a08163d 100644 --- a/backend/vendor/github.com/microcosm-cc/bluemonday/policy.go +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/policy.go @@ -74,6 +74,9 @@ type Policy struct { // When true, add crossorigin="anonymous" to HTML audio, img, link, script, and video tags requireCrossOriginAnonymous bool + // When true, add and filter sandbox attribute on iframe tags + requireSandboxOnIFrame map[string]bool + // When true add target="_blank" to fully qualified links // Will add for href="http://foo" // Will skip for href="/foo" or href="foo" @@ -189,6 +192,25 @@ type stylePolicyBuilder struct { type urlPolicy func(url *url.URL) (allowUrl bool) +type SandboxValue int64 + +const ( + SandboxAllowDownloads SandboxValue = iota + SandboxAllowDownloadsWithoutUserActivation + SandboxAllowForms + SandboxAllowModals + SandboxAllowOrientationLock + SandboxAllowPointerLock + SandboxAllowPopups + SandboxAllowPopupsToEscapeSandbox + SandboxAllowPresentation + SandboxAllowSameOrigin + SandboxAllowScripts + SandboxAllowStorageAccessByUserActivation + SandboxAllowTopNavigation + SandboxAllowTopNavigationByUserActivation +) + // init initializes the maps if this has not been done already func (p *Policy) init() { if !p.initialized { @@ -680,6 +702,58 @@ func (p *Policy) AllowURLSchemeWithCustomPolicy( return p } +// RequireSandboxOnIFrame will result in all iframe tags having a sandbox="" tag +// Any sandbox values not specified here will be filtered from the generated HTML +func (p *Policy) RequireSandboxOnIFrame(vals ...SandboxValue) { + p.requireSandboxOnIFrame = make(map[string]bool) + + for val := range vals { + switch SandboxValue(val) { + case SandboxAllowDownloads: + p.requireSandboxOnIFrame["allow-downloads"] = true + + case SandboxAllowDownloadsWithoutUserActivation: + p.requireSandboxOnIFrame["allow-downloads-without-user-activation"] = true + + case SandboxAllowForms: + p.requireSandboxOnIFrame["allow-forms"] = true + + case SandboxAllowModals: + p.requireSandboxOnIFrame["allow-modals"] = true + + case SandboxAllowOrientationLock: + p.requireSandboxOnIFrame["allow-orientation-lock"] = true + + case SandboxAllowPointerLock: + p.requireSandboxOnIFrame["allow-pointer-lock"] = true + + case SandboxAllowPopups: + p.requireSandboxOnIFrame["allow-popups"] = true + + case SandboxAllowPopupsToEscapeSandbox: + p.requireSandboxOnIFrame["allow-popups-to-escape-sandbox"] = true + + case SandboxAllowPresentation: + p.requireSandboxOnIFrame["allow-presentation"] = true + + case SandboxAllowSameOrigin: + p.requireSandboxOnIFrame["allow-same-origin"] = true + + case SandboxAllowScripts: + p.requireSandboxOnIFrame["allow-scripts"] = true + + case SandboxAllowStorageAccessByUserActivation: + p.requireSandboxOnIFrame["allow-storage-access-by-user-activation"] = true + + case SandboxAllowTopNavigation: + p.requireSandboxOnIFrame["allow-top-navigation"] = true + + case SandboxAllowTopNavigationByUserActivation: + p.requireSandboxOnIFrame["allow-top-navigation-by-user-activation"] = true + } + } +} + // AddSpaceWhenStrippingTag states whether to add a single space " " when // removing tags that are not allowed by the policy. // diff --git a/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go b/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go index 97628ce3..9bd91ab3 100644 --- a/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go +++ b/backend/vendor/github.com/microcosm-cc/bluemonday/sanitize.go @@ -240,7 +240,7 @@ func (p *Policy) sanitize(r io.Reader, w io.Writer) error { // rather than: // p := bluemonday.NewPolicy() // If this is the case, and if they haven't yet triggered an action that - // would initiliaze the maps, then we need to do that. + // would initialize the maps, then we need to do that. p.init() buff, ok := w.(stringWriterWriter) @@ -809,6 +809,33 @@ attrsLoop: } } + if p.requireSandboxOnIFrame != nil && elementName == "iframe" { + var sandboxFound bool + for i, htmlAttr := range cleanAttrs { + if htmlAttr.Key == "sandbox" { + sandboxFound = true + var cleanVals []string + cleanValsSet := make(map[string]bool) + for _, val := range strings.Fields(htmlAttr.Val) { + if p.requireSandboxOnIFrame[val] { + if !cleanValsSet[val] { + cleanVals = append(cleanVals, val) + cleanValsSet[val] = true + } + } + } + cleanAttrs[i].Val = strings.Join(cleanVals, " ") + } + } + + if !sandboxFound { + sandbox := html.Attribute{} + sandbox.Key = "sandbox" + sandbox.Val = "" + cleanAttrs = append(cleanAttrs, sandbox) + } + } + return cleanAttrs } diff --git a/backend/vendor/github.com/slack-go/slack/README.md b/backend/vendor/github.com/slack-go/slack/README.md index dbf73d4e..ee3eedcd 100644 --- a/backend/vendor/github.com/slack-go/slack/README.md +++ b/backend/vendor/github.com/slack-go/slack/README.md @@ -1,9 +1,9 @@ Slack API in Go [![Go Reference](https://pkg.go.dev/badge/github.com/slack-go/slack.svg)](https://pkg.go.dev/github.com/slack-go/slack) =============== -This is the original Slack library for Go created by Norberto Lopes, transferred to a Github organization. +This is the original Slack library for Go created by Norberto Lopes, transferred to a GitHub organization. -[![Join the chat at https://gitter.im/go-slack/Lobby](https://badges.gitter.im/go-slack/Lobby.svg)](https://gitter.im/go-slack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +You can also chat with us on the #slack-go, #slack-go-ja Slack channel on the Gophers Slack. ![logo](logo.png "icon") diff --git a/backend/vendor/github.com/slack-go/slack/block.go b/backend/vendor/github.com/slack-go/slack/block.go index 3686db85..240f5527 100644 --- a/backend/vendor/github.com/slack-go/slack/block.go +++ b/backend/vendor/github.com/slack-go/slack/block.go @@ -9,14 +9,15 @@ package slack type MessageBlockType string const ( - MBTSection MessageBlockType = "section" - MBTDivider MessageBlockType = "divider" - MBTImage MessageBlockType = "image" - MBTAction MessageBlockType = "actions" - MBTContext MessageBlockType = "context" - MBTFile MessageBlockType = "file" - MBTInput MessageBlockType = "input" - MBTHeader MessageBlockType = "header" + MBTSection MessageBlockType = "section" + MBTDivider MessageBlockType = "divider" + MBTImage MessageBlockType = "image" + MBTAction MessageBlockType = "actions" + MBTContext MessageBlockType = "context" + MBTFile MessageBlockType = "file" + MBTInput MessageBlockType = "input" + MBTHeader MessageBlockType = "header" + MBTRichText MessageBlockType = "rich_text" ) // Block defines an interface all block types should implement diff --git a/backend/vendor/github.com/slack-go/slack/block_conv.go b/backend/vendor/github.com/slack-go/slack/block_conv.go index 6936700a..c5378b60 100644 --- a/backend/vendor/github.com/slack-go/slack/block_conv.go +++ b/backend/vendor/github.com/slack-go/slack/block_conv.go @@ -65,6 +65,8 @@ func (b *Blocks) UnmarshalJSON(data []byte) error { block = &ImageBlock{} case "input": block = &InputBlock{} + case "rich_text": + block = &RichTextBlock{} case "section": block = &SectionBlock{} default: diff --git a/backend/vendor/github.com/slack-go/slack/block_element.go b/backend/vendor/github.com/slack-go/slack/block_element.go index bf068440..21abb018 100644 --- a/backend/vendor/github.com/slack-go/slack/block_element.go +++ b/backend/vendor/github.com/slack-go/slack/block_element.go @@ -389,13 +389,18 @@ func NewTimePickerBlockElement(actionID string) *TimePickerBlockElement { // // More Information: https://api.slack.com/reference/block-kit/block-elements#input type PlainTextInputBlockElement struct { - Type MessageElementType `json:"type"` - ActionID string `json:"action_id,omitempty"` - Placeholder *TextBlockObject `json:"placeholder,omitempty"` - InitialValue string `json:"initial_value,omitempty"` - Multiline bool `json:"multiline,omitempty"` - MinLength int `json:"min_length,omitempty"` - MaxLength int `json:"max_length,omitempty"` + Type MessageElementType `json:"type"` + ActionID string `json:"action_id,omitempty"` + Placeholder *TextBlockObject `json:"placeholder,omitempty"` + InitialValue string `json:"initial_value,omitempty"` + Multiline bool `json:"multiline,omitempty"` + MinLength int `json:"min_length,omitempty"` + MaxLength int `json:"max_length,omitempty"` + DispatchActionConfig *DispatchActionConfig `json:"dispatch_action_config,omitempty"` +} + +type DispatchActionConfig struct { + TriggerActionsOn []string `json:"trigger_actions_on,omitempty"` } // ElementType returns the type of the Element diff --git a/backend/vendor/github.com/slack-go/slack/block_rich_text.go b/backend/vendor/github.com/slack-go/slack/block_rich_text.go new file mode 100644 index 00000000..281db213 --- /dev/null +++ b/backend/vendor/github.com/slack-go/slack/block_rich_text.go @@ -0,0 +1,383 @@ +package slack + +import ( + "encoding/json" +) + +// RichTextBlock defines a new block of type rich_text. +// More Information: https://api.slack.com/changelog/2019-09-what-they-see-is-what-you-get-and-more-and-less +type RichTextBlock struct { + Type MessageBlockType `json:"type"` + BlockID string `json:"block_id,omitempty"` + Elements []RichTextElement `json:"elements"` +} + +func (b RichTextBlock) BlockType() MessageBlockType { + return b.Type +} + +func (e *RichTextBlock) UnmarshalJSON(b []byte) error { + var raw struct { + Type MessageBlockType `json:"type"` + BlockID string `json:"block_id"` + RawElements []json.RawMessage `json:"elements"` + } + if string(b) == "{}" { + return nil + } + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + elems := make([]RichTextElement, 0, len(raw.RawElements)) + for _, r := range raw.RawElements { + var s struct { + Type RichTextElementType `json:"type"` + } + if err := json.Unmarshal(r, &s); err != nil { + return err + } + var elem RichTextElement + switch s.Type { + case RTESection: + elem = &RichTextSection{} + default: + elems = append(elems, &RichTextUnknown{ + Type: s.Type, + Raw: string(r), + }) + continue + } + if err := json.Unmarshal(r, &elem); err != nil { + return err + } + elems = append(elems, elem) + } + *e = RichTextBlock{ + Type: raw.Type, + BlockID: raw.BlockID, + Elements: elems, + } + return nil +} + +// NewRichTextBlock returns a new instance of RichText Block. +func NewRichTextBlock(blockID string, elements ...RichTextElement) *RichTextBlock { + return &RichTextBlock{ + Type: MBTRichText, + BlockID: blockID, + Elements: elements, + } +} + +type RichTextElementType string + +type RichTextElement interface { + RichTextElementType() RichTextElementType +} + +const ( + RTEList RichTextElementType = "rich_text_list" + RTEPreformatted RichTextElementType = "rich_text_preformatted" + RTEQuote RichTextElementType = "rich_text_quote" + RTESection RichTextElementType = "rich_text_section" + RTEUnknown RichTextElementType = "rich_text_unknown" +) + +type RichTextUnknown struct { + Type RichTextElementType + Raw string +} + +func (u RichTextUnknown) RichTextElementType() RichTextElementType { + return u.Type +} + +type RichTextSection struct { + Type RichTextElementType `json:"type"` + Elements []RichTextSectionElement `json:"elements"` +} + +// ElementType returns the type of the Element +func (s RichTextSection) RichTextElementType() RichTextElementType { + return s.Type +} + +func (e *RichTextSection) UnmarshalJSON(b []byte) error { + var raw struct { + RawElements []json.RawMessage `json:"elements"` + } + if string(b) == "{}" { + return nil + } + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + elems := make([]RichTextSectionElement, 0, len(raw.RawElements)) + for _, r := range raw.RawElements { + var s struct { + Type RichTextSectionElementType `json:"type"` + } + if err := json.Unmarshal(r, &s); err != nil { + return err + } + var elem RichTextSectionElement + switch s.Type { + case RTSEText: + elem = &RichTextSectionTextElement{} + case RTSEChannel: + elem = &RichTextSectionChannelElement{} + case RTSEUser: + elem = &RichTextSectionUserElement{} + case RTSEEmoji: + elem = &RichTextSectionEmojiElement{} + case RTSELink: + elem = &RichTextSectionLinkElement{} + case RTSETeam: + elem = &RichTextSectionTeamElement{} + case RTSEUserGroup: + elem = &RichTextSectionUserGroupElement{} + case RTSEDate: + elem = &RichTextSectionDateElement{} + case RTSEBroadcast: + elem = &RichTextSectionBroadcastElement{} + case RTSEColor: + elem = &RichTextSectionColorElement{} + default: + elems = append(elems, &RichTextSectionUnknownElement{ + Type: s.Type, + Raw: string(r), + }) + continue + } + if err := json.Unmarshal(r, elem); err != nil { + return err + } + elems = append(elems, elem) + } + *e = RichTextSection{ + Type: RTESection, + Elements: elems, + } + return nil +} + +// NewRichTextSectionBlockElement . +func NewRichTextSection(elements ...RichTextSectionElement) *RichTextSection { + return &RichTextSection{ + Type: RTESection, + Elements: elements, + } +} + +type RichTextSectionElementType string + +const ( + RTSEBroadcast RichTextSectionElementType = "broadcast" + RTSEChannel RichTextSectionElementType = "channel" + RTSEColor RichTextSectionElementType = "color" + RTSEDate RichTextSectionElementType = "date" + RTSEEmoji RichTextSectionElementType = "emoji" + RTSELink RichTextSectionElementType = "link" + RTSETeam RichTextSectionElementType = "team" + RTSEText RichTextSectionElementType = "text" + RTSEUser RichTextSectionElementType = "user" + RTSEUserGroup RichTextSectionElementType = "usergroup" + + RTSEUnknown RichTextSectionElementType = "unknown" +) + +type RichTextSectionElement interface { + RichTextSectionElementType() RichTextSectionElementType +} + +type RichTextSectionTextStyle struct { + Bold bool `json:"bold,omitempty"` + Italic bool `json:"italic,omitempty"` + Strike bool `json:"strike,omitempty"` + Code bool `json:"code,omitempty"` +} + +type RichTextSectionTextElement struct { + Type RichTextSectionElementType `json:"type"` + Text string `json:"text"` + Style *RichTextSectionTextStyle `json:"style,omitempty"` +} + +func (r RichTextSectionTextElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionTextElement(text string, style *RichTextSectionTextStyle) *RichTextSectionTextElement { + return &RichTextSectionTextElement{ + Type: RTSEText, + Text: text, + Style: style, + } +} + +type RichTextSectionChannelElement struct { + Type RichTextSectionElementType `json:"type"` + ChannelID string `json:"channel_id"` + Style *RichTextSectionTextStyle `json:"style,omitempty"` +} + +func (r RichTextSectionChannelElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionChannelElement(channelID string, style *RichTextSectionTextStyle) *RichTextSectionChannelElement { + return &RichTextSectionChannelElement{ + Type: RTSEText, + ChannelID: channelID, + Style: style, + } +} + +type RichTextSectionUserElement struct { + Type RichTextSectionElementType `json:"type"` + UserID string `json:"user_id"` + Style *RichTextSectionTextStyle `json:"style,omitempty"` +} + +func (r RichTextSectionUserElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionUserElement(userID string, style *RichTextSectionTextStyle) *RichTextSectionUserElement { + return &RichTextSectionUserElement{ + Type: RTSEUser, + UserID: userID, + Style: style, + } +} + +type RichTextSectionEmojiElement struct { + Type RichTextSectionElementType `json:"type"` + Name string `json:"name"` + SkinTone int `json:"skin_tone"` + Style *RichTextSectionTextStyle `json:"style,omitempty"` +} + +func (r RichTextSectionEmojiElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionEmojiElement(name string, skinTone int, style *RichTextSectionTextStyle) *RichTextSectionEmojiElement { + return &RichTextSectionEmojiElement{ + Type: RTSEEmoji, + Name: name, + SkinTone: skinTone, + Style: style, + } +} + +type RichTextSectionLinkElement struct { + Type RichTextSectionElementType `json:"type"` + URL string `json:"url"` + Text string `json:"text"` + Style *RichTextSectionTextStyle `json:"style,omitempty"` +} + +func (r RichTextSectionLinkElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionLinkElement(url, text string, style *RichTextSectionTextStyle) *RichTextSectionLinkElement { + return &RichTextSectionLinkElement{ + Type: RTSELink, + URL: url, + Text: text, + Style: style, + } +} + +type RichTextSectionTeamElement struct { + Type RichTextSectionElementType `json:"type"` + TeamID string `json:"team_id"` + Style *RichTextSectionTextStyle `json:"style.omitempty"` +} + +func (r RichTextSectionTeamElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionTeamElement(teamID string, style *RichTextSectionTextStyle) *RichTextSectionTeamElement { + return &RichTextSectionTeamElement{ + Type: RTSETeam, + TeamID: teamID, + Style: style, + } +} + +type RichTextSectionUserGroupElement struct { + Type RichTextSectionElementType `json:"type"` + UsergroupID string `json:"usergroup_id"` +} + +func (r RichTextSectionUserGroupElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionUserGroupElement(usergroupID string) *RichTextSectionUserGroupElement { + return &RichTextSectionUserGroupElement{ + Type: RTSEUserGroup, + UsergroupID: usergroupID, + } +} + +type RichTextSectionDateElement struct { + Type RichTextSectionElementType `json:"type"` + Timestamp string `json:"timestamp"` +} + +func (r RichTextSectionDateElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionDateElement(timestamp string) *RichTextSectionDateElement { + return &RichTextSectionDateElement{ + Type: RTSEDate, + Timestamp: timestamp, + } +} + +type RichTextSectionBroadcastElement struct { + Type RichTextSectionElementType `json:"type"` + Range string `json:"range"` +} + +func (r RichTextSectionBroadcastElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionBroadcastElement(rangeStr string) *RichTextSectionBroadcastElement { + return &RichTextSectionBroadcastElement{ + Type: RTSEBroadcast, + Range: rangeStr, + } +} + +type RichTextSectionColorElement struct { + Type RichTextSectionElementType `json:"type"` + Value string `json:"value"` +} + +func (r RichTextSectionColorElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} + +func NewRichTextSectionColorElement(value string) *RichTextSectionColorElement { + return &RichTextSectionColorElement{ + Type: RTSEColor, + Value: value, + } +} + +type RichTextSectionUnknownElement struct { + Type RichTextSectionElementType `json:"type"` + Raw string +} + +func (r RichTextSectionUnknownElement) RichTextSectionElementType() RichTextSectionElementType { + return r.Type +} diff --git a/backend/vendor/github.com/slack-go/slack/chat.go b/backend/vendor/github.com/slack-go/slack/chat.go index 2a1e452e..493b65b6 100644 --- a/backend/vendor/github.com/slack-go/slack/chat.go +++ b/backend/vendor/github.com/slack-go/slack/chat.go @@ -188,7 +188,12 @@ func (api *Client) UpdateMessageContext(ctx context.Context, channelID, timestam // UnfurlMessage unfurls a message in a channel func (api *Client) UnfurlMessage(channelID, timestamp string, unfurls map[string]Attachment, options ...MsgOption) (string, string, string, error) { - return api.SendMessageContext(context.Background(), channelID, MsgOptionUnfurl(timestamp, unfurls), MsgOptionCompose(options...)) + return api.UnfurlMessageContext(context.Background(), channelID, timestamp, unfurls, options...) +} + +// UnfurlMessageContext unfurls a message in a channel with a custom context +func (api *Client) UnfurlMessageContext(ctx context.Context, channelID, timestamp string, unfurls map[string]Attachment, options ...MsgOption) (string, string, string, error) { + return api.SendMessageContext(ctx, channelID, MsgOptionUnfurl(timestamp, unfurls), MsgOptionCompose(options...)) } // UnfurlMessageWithAuthURL sends an unfurl request containing an diff --git a/backend/vendor/github.com/slack-go/slack/messages.go b/backend/vendor/github.com/slack-go/slack/messages.go index 999df5d9..2f05f6d7 100644 --- a/backend/vendor/github.com/slack-go/slack/messages.go +++ b/backend/vendor/github.com/slack-go/slack/messages.go @@ -19,6 +19,38 @@ type Message struct { PreviousMessage *Msg `json:"previous_message,omitempty"` } +// Msg SubTypes (https://api.slack.com/events/message) +const ( + MsgSubTypeBotMessage = "bot_message" // [Events API, RTM] A message was posted by an integration + MsgSubTypeMeMessage = "me_message" // [Events API, RTM] A /me message was sent + MsgSubTypeMessageChanged = "message_changed" // [Events API, RTM] A message was changed + MsgSubTypeMessageDeleted = "message_deleted" // [Events API, RTM] A message was deleted + MsgSubTypeMessageReplied = "message_replied" // [Events API, RTM] A message thread received a reply + MsgSubTypeReplyBroadcast = "reply_broadcast" // @Deprecated (No longer served) A message thread's reply was broadcast to a channel + MsgSubTypeThreadBroadcast = "thread_broadcast" // [Events API, RTM] A message thread's reply was broadcast to a channel + MsgSubTypeChannelJoin = "channel_join" // [Events API, RTM] A member joined a channel + MsgSubTypeChannelLeave = "channel_leave" // [Events API, RTM] A member left a channel + MsgSubTypeChannelTopic = "channel_topic" // [Events API, RTM] A channel topic was updated + MsgSubTypeChannelPurpose = "channel_purpose" // [Events API, RTM] A channel purpose was updated + MsgSubTypeChannelName = "channel_name" // [Events API, RTM] A channel was renamed + MsgSubTypeChannelArchive = "channel_archive" // [Events API, RTM] A channel was archived + MsgSubTypeChannelUnarchive = "channel_unarchive" // [Events API, RTM] A channel was unarchived + MsgSubTypeGroupJoin = "group_join" // [RTM] A member joined a group + MsgSubTypeGroupLeave = "group_leave" // [RTM] A member left a group + MsgSubTypeGroupTopic = "group_topic" // [RTM] A group topic was updated + MsgSubTypeGroupPurpose = "group_purpose" // [RTM] A group purpose was updated + MsgSubTypeGroupName = "group_name" // [RTM] A group was renamed + MsgSubTypeGroupArchive = "group_archive" // [RTM] A group was archived + MsgSubTypeGroupUnarchive = "group_unarchive" // [RTM] A group was unarchived + MsgSubTypeFileShare = "file_share" // [Events API, RTM] A file was shared into a channel + MsgSubTypeFileComment = "file_comment" // [RTM] A comment was added to a file + MsgSubTypeGileMention = "file_mention" // [RTM] A file was mentioned in a channel + MsgSubTypePinnedItem = "pinned_item" // [RTM] An item was pinned in a channel + MsgSubTypeUnpinnedItem = "unpinned_item" // [RTM] An item was unpinned from a channel + MsgSubTypeEkmAccessDenied = "ekm_access_denied" // [Events API, RTM] Message content redacted due to Enterprise Key Management (EKM) + MsgSubTypeChannelPostingPermissions = "channel_posting_permissions" // [Events API, RTM] The posting permissions for a channel changed +) + // Msg contains information about a slack message type Msg struct { // Basic Message diff --git a/backend/vendor/github.com/slack-go/slack/misc.go b/backend/vendor/github.com/slack-go/slack/misc.go index 8c50305b..5272e7c4 100644 --- a/backend/vendor/github.com/slack-go/slack/misc.go +++ b/backend/vendor/github.com/slack-go/slack/misc.go @@ -41,9 +41,17 @@ func (t SlackResponse) Err() error { return nil } - return errors.New(t.Error) + return SlackErrorResponse{Err: t.Error, ResponseMetadata: t.ResponseMetadata} } +// SlackErrorResponse brings along the metadata of errors returned by the Slack API. +type SlackErrorResponse struct { + Err string + ResponseMetadata ResponseMetadata +} + +func (r SlackErrorResponse) Error() string { return r.Err } + // RateLimitedError represents the rate limit respond from slack type RateLimitedError struct { RetryAfter time.Duration diff --git a/backend/vendor/github.com/slack-go/slack/oauth.go b/backend/vendor/github.com/slack-go/slack/oauth.go index 707ccc6b..d9aca5f3 100644 --- a/backend/vendor/github.com/slack-go/slack/oauth.go +++ b/backend/vendor/github.com/slack-go/slack/oauth.go @@ -42,6 +42,8 @@ type OAuthV2Response struct { IncomingWebhook OAuthResponseIncomingWebhook `json:"incoming_webhook"` Enterprise OAuthV2ResponseEnterprise `json:"enterprise"` AuthedUser OAuthV2ResponseAuthedUser `json:"authed_user"` + RefreshToken string `json:"refresh_token"` + ExpiresIn int `json:"expires_in"` SlackResponse } @@ -132,3 +134,23 @@ func GetOAuthV2ResponseContext(ctx context.Context, client httpClient, clientID, } return response, response.Err() } + +// RefreshOAuthV2AccessContext with a context, gets a V2 OAuth access token response +func RefreshOAuthV2Token(client httpClient, clientID, clientSecret, refreshToken string) (resp *OAuthV2Response, err error) { + return RefreshOAuthV2TokenContext(context.Background(), client, clientID, clientSecret, refreshToken) +} + +// RefreshOAuthV2AccessContext with a context, gets a V2 OAuth access token response +func RefreshOAuthV2TokenContext(ctx context.Context, client httpClient, clientID, clientSecret, refreshToken string) (resp *OAuthV2Response, err error) { + values := url.Values{ + "client_id": {clientID}, + "client_secret": {clientSecret}, + "refresh_token": {refreshToken}, + "grant_type": {"refresh_token"}, + } + response := &OAuthV2Response{} + if err = postForm(ctx, client, APIURL+"oauth.v2.access", values, response, discard{}); err != nil { + return nil, err + } + return response, response.Err() +} diff --git a/backend/vendor/github.com/slack-go/slack/users.go b/backend/vendor/github.com/slack-go/slack/users.go index 3696e37f..87311569 100644 --- a/backend/vendor/github.com/slack-go/slack/users.go +++ b/backend/vendor/github.com/slack-go/slack/users.go @@ -469,9 +469,7 @@ func (api *Client) SetUserPhoto(image string, params UserSetPhotoParams) error { // SetUserPhotoContext changes the currently authenticated user's profile image using a custom context func (api *Client) SetUserPhotoContext(ctx context.Context, image string, params UserSetPhotoParams) (err error) { response := &SlackResponse{} - values := url.Values{ - "token": {api.token}, - } + values := url.Values{} if params.CropX != DEFAULT_USER_PHOTO_CROP_X { values.Add("crop_x", strconv.Itoa(params.CropX)) } diff --git a/backend/vendor/github.com/slack-go/slack/webhooks.go b/backend/vendor/github.com/slack-go/slack/webhooks.go index 39fff441..97346e1c 100644 --- a/backend/vendor/github.com/slack-go/slack/webhooks.go +++ b/backend/vendor/github.com/slack-go/slack/webhooks.go @@ -15,6 +15,9 @@ type WebhookMessage struct { Attachments []Attachment `json:"attachments,omitempty"` Parse string `json:"parse,omitempty"` Blocks *Blocks `json:"blocks,omitempty"` + ResponseType string `json:"response_type,omitempty"` + ReplaceOriginal bool `json:"replace_original,omitempty"` + DeleteOriginal bool `json:"delete_original,omitempty"` } func PostWebhook(url string, msg *WebhookMessage) error { diff --git a/backend/vendor/github.com/stretchr/objx/.codeclimate.yml b/backend/vendor/github.com/stretchr/objx/.codeclimate.yml index 010d4ccd..559fa399 100644 --- a/backend/vendor/github.com/stretchr/objx/.codeclimate.yml +++ b/backend/vendor/github.com/stretchr/objx/.codeclimate.yml @@ -10,4 +10,12 @@ exclude_patterns: - ".github/" - "vendor/" - "codegen/" +- "*.yml" +- ".*.yml" +- "*.md" +- "Gopkg.*" - "doc.go" +- "type_specific_codegen_test.go" +- "type_specific_codegen.go" +- ".gitignore" +- "LICENSE" diff --git a/backend/vendor/github.com/stretchr/objx/.travis.yml b/backend/vendor/github.com/stretchr/objx/.travis.yml index a63efa59..cde6eb2a 100644 --- a/backend/vendor/github.com/stretchr/objx/.travis.yml +++ b/backend/vendor/github.com/stretchr/objx/.travis.yml @@ -1,8 +1,14 @@ language: go go: - - 1.8 - - 1.9 - - tip + - "1.10.x" + - "1.11.x" + - "1.12.x" + - master + +matrix: + allow_failures: + - go: master +fast_finish: true env: global: @@ -14,12 +20,11 @@ before_script: - ./cc-test-reporter before-build install: -- go get github.com/go-task/task/cmd/task + - curl -sL https://taskfile.dev/install.sh | sh script: -- task dl-deps -- task lint -- task test-coverage + - diff -u <(echo -n) <(./bin/task lint) + - ./bin/task test-coverage after_script: - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT diff --git a/backend/vendor/github.com/stretchr/objx/Gopkg.lock b/backend/vendor/github.com/stretchr/objx/Gopkg.lock deleted file mode 100644 index eebe342a..00000000 --- a/backend/vendor/github.com/stretchr/objx/Gopkg.lock +++ /dev/null @@ -1,30 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/davecgh/go-spew" - packages = ["spew"] - revision = "346938d642f2ec3594ed81d874461961cd0faa76" - version = "v1.1.0" - -[[projects]] - name = "github.com/pmezard/go-difflib" - packages = ["difflib"] - revision = "792786c7400a136282c1664665ae0a8db921c6c2" - version = "v1.0.0" - -[[projects]] - name = "github.com/stretchr/testify" - packages = [ - "assert", - "require" - ] - revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c" - version = "v1.2.0" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "2d160a7dea4ffd13c6c31dab40373822f9d78c73beba016d662bef8f7a998876" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/backend/vendor/github.com/stretchr/objx/Gopkg.toml b/backend/vendor/github.com/stretchr/objx/Gopkg.toml deleted file mode 100644 index d70f1570..00000000 --- a/backend/vendor/github.com/stretchr/objx/Gopkg.toml +++ /dev/null @@ -1,8 +0,0 @@ -[prune] - unused-packages = true - non-go = true - go-tests = true - -[[constraint]] - name = "github.com/stretchr/testify" - version = "~1.2.0" diff --git a/backend/vendor/github.com/stretchr/objx/README.md b/backend/vendor/github.com/stretchr/objx/README.md index be5750c9..246660b2 100644 --- a/backend/vendor/github.com/stretchr/objx/README.md +++ b/backend/vendor/github.com/stretchr/objx/README.md @@ -74,7 +74,7 @@ To update Objx to the latest version, run: go get -u github.com/stretchr/objx ### Supported go versions -We support the lastest two major Go versions, which are 1.8 and 1.9 at the moment. +We support the lastest three major Go versions, which are 1.10, 1.11 and 1.12 at the moment. ## Contributing Please feel free to submit issues, fork the repository and send pull requests! diff --git a/backend/vendor/github.com/stretchr/objx/Taskfile.yml b/backend/vendor/github.com/stretchr/objx/Taskfile.yml index f8035641..a749ac54 100644 --- a/backend/vendor/github.com/stretchr/objx/Taskfile.yml +++ b/backend/vendor/github.com/stretchr/objx/Taskfile.yml @@ -1,32 +1,30 @@ -default: - deps: [test] +version: '2' -dl-deps: - desc: Downloads cli dependencies - cmds: - - go get -u github.com/golang/lint/golint - - go get -u github.com/golang/dep/cmd/dep +env: + GOFLAGS: -mod=vendor -update-deps: - desc: Updates dependencies - cmds: - - dep ensure - - dep ensure -update +tasks: + default: + deps: [test] -lint: - desc: Runs golint - cmds: - - go fmt $(go list ./... | grep -v /vendor/) - - go vet $(go list ./... | grep -v /vendor/) - - golint $(ls *.go | grep -v "doc.go") - silent: true + lint: + desc: Checks code style + cmds: + - gofmt -d -s *.go + - go vet ./... + silent: true -test: - desc: Runs go tests - cmds: - - go test -race . + lint-fix: + desc: Fixes code style + cmds: + - gofmt -w -s *.go -test-coverage: - desc: Runs go tests and calucates test coverage - cmds: - - go test -coverprofile=c.out . + test: + desc: Runs go tests + cmds: + - go test -race ./... + + test-coverage: + desc: Runs go tests and calucates test coverage + cmds: + - go test -race -coverprofile=c.out ./... diff --git a/backend/vendor/github.com/stretchr/objx/accessors.go b/backend/vendor/github.com/stretchr/objx/accessors.go index 204356a2..80ad1674 100644 --- a/backend/vendor/github.com/stretchr/objx/accessors.go +++ b/backend/vendor/github.com/stretchr/objx/accessors.go @@ -1,18 +1,34 @@ package objx import ( + "reflect" "regexp" "strconv" "strings" ) -// arrayAccesRegexString is the regex used to extract the array number -// from the access path -const arrayAccesRegexString = `^(.+)\[([0-9]+)\]$` +const ( + // PathSeparator is the character used to separate the elements + // of the keypath. + // + // For example, `location.address.city` + PathSeparator string = "." + + // arrayAccesRegexString is the regex used to extract the array number + // from the access path + arrayAccesRegexString = `^(.+)\[([0-9]+)\]$` + + // mapAccessRegexString is the regex used to extract the map key + // from the access path + mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$` +) // arrayAccesRegex is the compiled arrayAccesRegexString var arrayAccesRegex = regexp.MustCompile(arrayAccesRegexString) +// mapAccessRegex is the compiled mapAccessRegexString +var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) + // Get gets the value using the specified selector and // returns it inside a new Obj object. // @@ -46,103 +62,118 @@ func (m Map) Set(selector string, value interface{}) Map { return m } +// getIndex returns the index, which is hold in s by two braches. +// It also returns s withour the index part, e.g. name[1] will return (1, name). +// If no index is found, -1 is returned +func getIndex(s string) (int, string) { + arrayMatches := arrayAccesRegex.FindStringSubmatch(s) + if len(arrayMatches) > 0 { + // Get the key into the map + selector := arrayMatches[1] + // Get the index into the array at the key + // We know this cannt fail because arrayMatches[2] is an int for sure + index, _ := strconv.Atoi(arrayMatches[2]) + return index, selector + } + return -1, s +} + +// getKey returns the key which is held in s by two brackets. +// It also returns the next selector. +func getKey(s string) (string, string) { + selSegs := strings.SplitN(s, PathSeparator, 2) + thisSel := selSegs[0] + nextSel := "" + + if len(selSegs) > 1 { + nextSel = selSegs[1] + } + + mapMatches := mapAccessRegex.FindStringSubmatch(s) + if len(mapMatches) > 0 { + if _, err := strconv.Atoi(mapMatches[2]); err != nil { + thisSel = mapMatches[1] + nextSel = "[" + mapMatches[2] + "]" + mapMatches[3] + + if thisSel == "" { + thisSel = mapMatches[2] + nextSel = mapMatches[3] + } + + if nextSel == "" { + selSegs = []string{"", ""} + } else if nextSel[0] == '.' { + nextSel = nextSel[1:] + } + } + } + + return thisSel, nextSel +} + // access accesses the object using the selector and performs the // appropriate action. -func access(current, selector, value interface{}, isSet bool) interface{} { - switch selector.(type) { - case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: - if array, ok := current.([]interface{}); ok { - index := intFromInterface(selector) - if index >= len(array) { - return nil - } - return array[index] +func access(current interface{}, selector string, value interface{}, isSet bool) interface{} { + thisSel, nextSel := getKey(selector) + + index := -1 + if strings.Contains(thisSel, "[") { + index, thisSel = getIndex(thisSel) + } + + if curMap, ok := current.(Map); ok { + current = map[string]interface{}(curMap) + } + // get the object in question + switch current.(type) { + case map[string]interface{}: + curMSI := current.(map[string]interface{}) + if nextSel == "" && isSet { + curMSI[thisSel] = value + return nil } - return nil - case string: - selStr := selector.(string) - selSegs := strings.SplitN(selStr, PathSeparator, 2) - thisSel := selSegs[0] - index := -1 - var err error + _, ok := curMSI[thisSel].(map[string]interface{}) + if (curMSI[thisSel] == nil || !ok) && index == -1 && isSet { + curMSI[thisSel] = map[string]interface{}{} + } - if strings.Contains(thisSel, "[") { - arrayMatches := arrayAccesRegex.FindStringSubmatch(thisSel) - if len(arrayMatches) > 0 { - // Get the key into the map - thisSel = arrayMatches[1] + current = curMSI[thisSel] + default: + current = nil + } - // Get the index into the array at the key - index, err = strconv.Atoi(arrayMatches[2]) - - if err != nil { - // This should never happen. If it does, something has gone - // seriously wrong. Panic. - panic("objx: Array index is not an integer. Must use array[int].") - } + // do we need to access the item of an array? + if index > -1 { + if array, ok := interSlice(current); ok { + if index < len(array) { + current = array[index] + } else { + current = nil } } - if curMap, ok := current.(Map); ok { - current = map[string]interface{}(curMap) - } - // get the object in question - switch current.(type) { - case map[string]interface{}: - curMSI := current.(map[string]interface{}) - if len(selSegs) <= 1 && isSet { - curMSI[thisSel] = value - return nil - } - current = curMSI[thisSel] - default: - current = nil - } - // do we need to access the item of an array? - if index > -1 { - if array, ok := current.([]interface{}); ok { - if index < len(array) { - current = array[index] - } else { - current = nil - } - } - } - if len(selSegs) > 1 { - current = access(current, selSegs[1], value, isSet) - } + } + if nextSel != "" { + current = access(current, nextSel, value, isSet) } return current } -// intFromInterface converts an interface object to the largest -// representation of an unsigned integer using a type switch and -// assertions -func intFromInterface(selector interface{}) int { - var value int - switch selector.(type) { - case int: - value = selector.(int) - case int8: - value = int(selector.(int8)) - case int16: - value = int(selector.(int16)) - case int32: - value = int(selector.(int32)) - case int64: - value = int(selector.(int64)) - case uint: - value = int(selector.(uint)) - case uint8: - value = int(selector.(uint8)) - case uint16: - value = int(selector.(uint16)) - case uint32: - value = int(selector.(uint32)) - case uint64: - value = int(selector.(uint64)) - default: - return 0 +func interSlice(slice interface{}) ([]interface{}, bool) { + if array, ok := slice.([]interface{}); ok { + return array, ok } - return value + + s := reflect.ValueOf(slice) + if s.Kind() != reflect.Slice { + return nil, false + } + + ret := make([]interface{}, s.Len()) + + for i := 0; i < s.Len(); i++ { + ret[i] = s.Index(i).Interface() + } + + return ret, true } diff --git a/backend/vendor/github.com/stretchr/objx/constants.go b/backend/vendor/github.com/stretchr/objx/constants.go deleted file mode 100644 index f9eb42a2..00000000 --- a/backend/vendor/github.com/stretchr/objx/constants.go +++ /dev/null @@ -1,13 +0,0 @@ -package objx - -const ( - // PathSeparator is the character used to separate the elements - // of the keypath. - // - // For example, `location.address.city` - PathSeparator string = "." - - // SignatureSeparator is the character that is used to - // separate the Base64 string from the security signature. - SignatureSeparator = "_" -) diff --git a/backend/vendor/github.com/stretchr/objx/conversions.go b/backend/vendor/github.com/stretchr/objx/conversions.go index 5e020f31..080aa46e 100644 --- a/backend/vendor/github.com/stretchr/objx/conversions.go +++ b/backend/vendor/github.com/stretchr/objx/conversions.go @@ -7,11 +7,51 @@ import ( "errors" "fmt" "net/url" + "strconv" ) +// SignatureSeparator is the character that is used to +// separate the Base64 string from the security signature. +const SignatureSeparator = "_" + +// URLValuesSliceKeySuffix is the character that is used to +// specify a suffic for slices parsed by URLValues. +// If the suffix is set to "[i]", then the index of the slice +// is used in place of i +// Ex: Suffix "[]" would have the form a[]=b&a[]=c +// OR Suffix "[i]" would have the form a[0]=b&a[1]=c +// OR Suffix "" would have the form a=b&a=c +var urlValuesSliceKeySuffix = "[]" + +const ( + URLValuesSliceKeySuffixEmpty = "" + URLValuesSliceKeySuffixArray = "[]" + URLValuesSliceKeySuffixIndex = "[i]" +) + +// SetURLValuesSliceKeySuffix sets the character that is used to +// specify a suffic for slices parsed by URLValues. +// If the suffix is set to "[i]", then the index of the slice +// is used in place of i +// Ex: Suffix "[]" would have the form a[]=b&a[]=c +// OR Suffix "[i]" would have the form a[0]=b&a[1]=c +// OR Suffix "" would have the form a=b&a=c +func SetURLValuesSliceKeySuffix(s string) error { + if s == URLValuesSliceKeySuffixEmpty || s == URLValuesSliceKeySuffixArray || s == URLValuesSliceKeySuffixIndex { + urlValuesSliceKeySuffix = s + return nil + } + + return errors.New("objx: Invalid URLValuesSliceKeySuffix provided.") +} + // JSON converts the contained object to a JSON string // representation func (m Map) JSON() (string, error) { + for k, v := range m { + m[k] = cleanUp(v) + } + result, err := json.Marshal(m) if err != nil { err = errors.New("objx: JSON encode failed with: " + err.Error()) @@ -19,6 +59,63 @@ func (m Map) JSON() (string, error) { return string(result), err } +func cleanUpInterfaceArray(in []interface{}) []interface{} { + result := make([]interface{}, len(in)) + for i, v := range in { + result[i] = cleanUp(v) + } + return result +} + +func cleanUpInterfaceMap(in map[interface{}]interface{}) Map { + result := Map{} + for k, v := range in { + result[fmt.Sprintf("%v", k)] = cleanUp(v) + } + return result +} + +func cleanUpStringMap(in map[string]interface{}) Map { + result := Map{} + for k, v := range in { + result[k] = cleanUp(v) + } + return result +} + +func cleanUpMSIArray(in []map[string]interface{}) []Map { + result := make([]Map, len(in)) + for i, v := range in { + result[i] = cleanUpStringMap(v) + } + return result +} + +func cleanUpMapArray(in []Map) []Map { + result := make([]Map, len(in)) + for i, v := range in { + result[i] = cleanUpStringMap(v) + } + return result +} + +func cleanUp(v interface{}) interface{} { + switch v := v.(type) { + case []interface{}: + return cleanUpInterfaceArray(v) + case []map[string]interface{}: + return cleanUpMSIArray(v) + case map[interface{}]interface{}: + return cleanUpInterfaceMap(v) + case Map: + return cleanUpStringMap(v) + case []Map: + return cleanUpMapArray(v) + default: + return v + } +} + // MustJSON converts the contained object to a JSON string // representation and panics if there is an error func (m Map) MustJSON() string { @@ -40,10 +137,7 @@ func (m Map) Base64() (string, error) { } encoder := base64.NewEncoder(base64.StdEncoding, &buf) - _, err = encoder.Write([]byte(jsonData)) - if err != nil { - return "", err - } + _, _ = encoder.Write([]byte(jsonData)) _ = encoder.Close() return buf.String(), nil @@ -93,13 +187,91 @@ func (m Map) MustSignedBase64(key string) string { // function requires that the wrapped object be a map[string]interface{} func (m Map) URLValues() url.Values { vals := make(url.Values) - for k, v := range m { - //TODO: can this be done without sprintf? - vals.Set(k, fmt.Sprintf("%v", v)) - } + + m.parseURLValues(m, vals, "") + return vals } +func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) { + useSliceIndex := false + if urlValuesSliceKeySuffix == "[i]" { + useSliceIndex = true + } + + for k, v := range queryMap { + val := &Value{data: v} + switch { + case val.IsObjxMap(): + if key == "" { + m.parseURLValues(val.ObjxMap(), vals, k) + } else { + m.parseURLValues(val.ObjxMap(), vals, key+"["+k+"]") + } + case val.IsObjxMapSlice(): + sliceKey := k + if key != "" { + sliceKey = key + "[" + k + "]" + } + + if useSliceIndex { + for i, sv := range val.MustObjxMapSlice() { + sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" + m.parseURLValues(sv, vals, sk) + } + } else { + sliceKey = sliceKey + urlValuesSliceKeySuffix + for _, sv := range val.MustObjxMapSlice() { + m.parseURLValues(sv, vals, sliceKey) + } + } + case val.IsMSISlice(): + sliceKey := k + if key != "" { + sliceKey = key + "[" + k + "]" + } + + if useSliceIndex { + for i, sv := range val.MustMSISlice() { + sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" + m.parseURLValues(New(sv), vals, sk) + } + } else { + sliceKey = sliceKey + urlValuesSliceKeySuffix + for _, sv := range val.MustMSISlice() { + m.parseURLValues(New(sv), vals, sliceKey) + } + } + case val.IsStrSlice(), val.IsBoolSlice(), + val.IsFloat32Slice(), val.IsFloat64Slice(), + val.IsIntSlice(), val.IsInt8Slice(), val.IsInt16Slice(), val.IsInt32Slice(), val.IsInt64Slice(), + val.IsUintSlice(), val.IsUint8Slice(), val.IsUint16Slice(), val.IsUint32Slice(), val.IsUint64Slice(): + + sliceKey := k + if key != "" { + sliceKey = key + "[" + k + "]" + } + + if useSliceIndex { + for i, sv := range val.StringSlice() { + sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" + vals.Set(sk, sv) + } + } else { + sliceKey = sliceKey + urlValuesSliceKeySuffix + vals[sliceKey] = val.StringSlice() + } + + default: + if key == "" { + vals.Set(k, val.String()) + } else { + vals.Set(key+"["+k+"]", val.String()) + } + } + } +} + // URLQuery gets an encoded URL query representing the given // Obj. This function requires that the wrapped object be a // map[string]interface{} diff --git a/backend/vendor/github.com/stretchr/objx/go.mod b/backend/vendor/github.com/stretchr/objx/go.mod new file mode 100644 index 00000000..31ec5a7d --- /dev/null +++ b/backend/vendor/github.com/stretchr/objx/go.mod @@ -0,0 +1,8 @@ +module github.com/stretchr/objx + +go 1.12 + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/stretchr/testify v1.3.0 +) diff --git a/backend/vendor/github.com/stretchr/objx/go.sum b/backend/vendor/github.com/stretchr/objx/go.sum new file mode 100644 index 00000000..4f898415 --- /dev/null +++ b/backend/vendor/github.com/stretchr/objx/go.sum @@ -0,0 +1,8 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/backend/vendor/github.com/stretchr/objx/map.go b/backend/vendor/github.com/stretchr/objx/map.go index 406bc892..95149c06 100644 --- a/backend/vendor/github.com/stretchr/objx/map.go +++ b/backend/vendor/github.com/stretchr/objx/map.go @@ -97,12 +97,50 @@ func MustFromJSON(jsonString string) Map { // // Returns an error if the JSON is invalid. func FromJSON(jsonString string) (Map, error) { - var data interface{} - err := json.Unmarshal([]byte(jsonString), &data) + var m Map + err := json.Unmarshal([]byte(jsonString), &m) if err != nil { return Nil, err } - return New(data), nil + m.tryConvertFloat64() + return m, nil +} + +func (m Map) tryConvertFloat64() { + for k, v := range m { + switch v.(type) { + case float64: + f := v.(float64) + if float64(int(f)) == f { + m[k] = int(f) + } + case map[string]interface{}: + t := New(v) + t.tryConvertFloat64() + m[k] = t + case []interface{}: + m[k] = tryConvertFloat64InSlice(v.([]interface{})) + } + } +} + +func tryConvertFloat64InSlice(s []interface{}) []interface{} { + for k, v := range s { + switch v.(type) { + case float64: + f := v.(float64) + if float64(int(f)) == f { + s[k] = int(f) + } + case map[string]interface{}: + t := New(v) + t.tryConvertFloat64() + s[k] = t + case []interface{}: + s[k] = tryConvertFloat64InSlice(v.([]interface{})) + } + } + return s } // FromBase64 creates a new Obj containing the data specified diff --git a/backend/vendor/github.com/stretchr/objx/type_specific.go b/backend/vendor/github.com/stretchr/objx/type_specific.go new file mode 100644 index 00000000..80f88d9f --- /dev/null +++ b/backend/vendor/github.com/stretchr/objx/type_specific.go @@ -0,0 +1,346 @@ +package objx + +/* + MSI (map[string]interface{} and []map[string]interface{}) +*/ + +// MSI gets the value as a map[string]interface{}, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { + if s, ok := v.data.(map[string]interface{}); ok { + return s + } + if s, ok := v.data.(Map); ok { + return map[string]interface{}(s) + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustMSI gets the value as a map[string]interface{}. +// +// Panics if the object is not a map[string]interface{}. +func (v *Value) MustMSI() map[string]interface{} { + if s, ok := v.data.(Map); ok { + return map[string]interface{}(s) + } + return v.data.(map[string]interface{}) +} + +// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault +// value or nil if the value is not a []map[string]interface{}. +func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { + if s, ok := v.data.([]map[string]interface{}); ok { + return s + } + + s := v.ObjxMapSlice() + if s == nil { + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil + } + + result := make([]map[string]interface{}, len(s)) + for i := range s { + result[i] = s[i].Value().MSI() + } + return result +} + +// MustMSISlice gets the value as a []map[string]interface{}. +// +// Panics if the object is not a []map[string]interface{}. +func (v *Value) MustMSISlice() []map[string]interface{} { + if s := v.MSISlice(); s != nil { + return s + } + + return v.data.([]map[string]interface{}) +} + +// IsMSI gets whether the object contained is a map[string]interface{} or not. +func (v *Value) IsMSI() bool { + _, ok := v.data.(map[string]interface{}) + if !ok { + _, ok = v.data.(Map) + } + return ok +} + +// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. +func (v *Value) IsMSISlice() bool { + _, ok := v.data.([]map[string]interface{}) + if !ok { + _, ok = v.data.([]Map) + if !ok { + s, ok := v.data.([]interface{}) + if ok { + for i := range s { + switch s[i].(type) { + case Map: + case map[string]interface{}: + default: + return false + } + } + return true + } + } + } + return ok +} + +// EachMSI calls the specified callback for each object +// in the []map[string]interface{}. +// +// Panics if the object is the wrong type. +func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { + for index, val := range v.MustMSISlice() { + carryon := callback(index, val) + if !carryon { + break + } + } + return v +} + +// WhereMSI uses the specified decider function to select items +// from the []map[string]interface{}. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { + var selected []map[string]interface{} + v.EachMSI(func(index int, val map[string]interface{}) bool { + shouldSelect := decider(index, val) + if !shouldSelect { + selected = append(selected, val) + } + return true + }) + return &Value{data: selected} +} + +// GroupMSI uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]map[string]interface{}. +func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { + groups := make(map[string][]map[string]interface{}) + v.EachMSI(func(index int, val map[string]interface{}) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]map[string]interface{}, 0) + } + groups[group] = append(groups[group], val) + return true + }) + return &Value{data: groups} +} + +// ReplaceMSI uses the specified function to replace each map[string]interface{}s +// by iterating each item. The data in the returned result will be a +// []map[string]interface{} containing the replaced items. +func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { + arr := v.MustMSISlice() + replaced := make([]map[string]interface{}, len(arr)) + v.EachMSI(func(index int, val map[string]interface{}) bool { + replaced[index] = replacer(index, val) + return true + }) + return &Value{data: replaced} +} + +// CollectMSI uses the specified collector function to collect a value +// for each of the map[string]interface{}s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { + arr := v.MustMSISlice() + collected := make([]interface{}, len(arr)) + v.EachMSI(func(index int, val map[string]interface{}) bool { + collected[index] = collector(index, val) + return true + }) + return &Value{data: collected} +} + +/* + ObjxMap ((Map) and [](Map)) +*/ + +// ObjxMap gets the value as a (Map), returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { + if s, ok := v.data.((Map)); ok { + return s + } + if s, ok := v.data.(map[string]interface{}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return New(nil) +} + +// MustObjxMap gets the value as a (Map). +// +// Panics if the object is not a (Map). +func (v *Value) MustObjxMap() Map { + if s, ok := v.data.(map[string]interface{}); ok { + return s + } + return v.data.((Map)) +} + +// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault +// value or nil if the value is not a [](Map). +func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { + if s, ok := v.data.([]Map); ok { + return s + } + + if s, ok := v.data.([]map[string]interface{}); ok { + result := make([]Map, len(s)) + for i := range s { + result[i] = s[i] + } + return result + } + + s, ok := v.data.([]interface{}) + if !ok { + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil + } + + result := make([]Map, len(s)) + for i := range s { + switch s[i].(type) { + case Map: + result[i] = s[i].(Map) + case map[string]interface{}: + result[i] = New(s[i]) + default: + return nil + } + } + return result +} + +// MustObjxMapSlice gets the value as a [](Map). +// +// Panics if the object is not a [](Map). +func (v *Value) MustObjxMapSlice() [](Map) { + if s := v.ObjxMapSlice(); s != nil { + return s + } + return v.data.([](Map)) +} + +// IsObjxMap gets whether the object contained is a (Map) or not. +func (v *Value) IsObjxMap() bool { + _, ok := v.data.((Map)) + if !ok { + _, ok = v.data.(map[string]interface{}) + } + return ok +} + +// IsObjxMapSlice gets whether the object contained is a [](Map) or not. +func (v *Value) IsObjxMapSlice() bool { + _, ok := v.data.([](Map)) + if !ok { + _, ok = v.data.([]map[string]interface{}) + if !ok { + s, ok := v.data.([]interface{}) + if ok { + for i := range s { + switch s[i].(type) { + case Map: + case map[string]interface{}: + default: + return false + } + } + return true + } + } + } + + return ok +} + +// EachObjxMap calls the specified callback for each object +// in the [](Map). +// +// Panics if the object is the wrong type. +func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { + for index, val := range v.MustObjxMapSlice() { + carryon := callback(index, val) + if !carryon { + break + } + } + return v +} + +// WhereObjxMap uses the specified decider function to select items +// from the [](Map). The object contained in the result will contain +// only the selected items. +func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { + var selected [](Map) + v.EachObjxMap(func(index int, val Map) bool { + shouldSelect := decider(index, val) + if !shouldSelect { + selected = append(selected, val) + } + return true + }) + return &Value{data: selected} +} + +// GroupObjxMap uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][](Map). +func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { + groups := make(map[string][](Map)) + v.EachObjxMap(func(index int, val Map) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([](Map), 0) + } + groups[group] = append(groups[group], val) + return true + }) + return &Value{data: groups} +} + +// ReplaceObjxMap uses the specified function to replace each (Map)s +// by iterating each item. The data in the returned result will be a +// [](Map) containing the replaced items. +func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { + arr := v.MustObjxMapSlice() + replaced := make([](Map), len(arr)) + v.EachObjxMap(func(index int, val Map) bool { + replaced[index] = replacer(index, val) + return true + }) + return &Value{data: replaced} +} + +// CollectObjxMap uses the specified collector function to collect a value +// for each of the (Map)s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { + arr := v.MustObjxMapSlice() + collected := make([]interface{}, len(arr)) + v.EachObjxMap(func(index int, val Map) bool { + collected[index] = collector(index, val) + return true + }) + return &Value{data: collected} +} diff --git a/backend/vendor/github.com/stretchr/objx/type_specific_codegen.go b/backend/vendor/github.com/stretchr/objx/type_specific_codegen.go index 202a91f8..9859b407 100644 --- a/backend/vendor/github.com/stretchr/objx/type_specific_codegen.go +++ b/backend/vendor/github.com/stretchr/objx/type_specific_codegen.go @@ -1,7 +1,7 @@ package objx /* - Inter (interface{} and []interface{}) + Inter (interface{} and []interface{}) */ // Inter gets the value as a interface{}, returns the optionalDefault @@ -126,257 +126,7 @@ func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Valu } /* - MSI (map[string]interface{} and []map[string]interface{}) -*/ - -// MSI gets the value as a map[string]interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustMSI gets the value as a map[string]interface{}. -// -// Panics if the object is not a map[string]interface{}. -func (v *Value) MustMSI() map[string]interface{} { - return v.data.(map[string]interface{}) -} - -// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault -// value or nil if the value is not a []map[string]interface{}. -func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { - if s, ok := v.data.([]map[string]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustMSISlice gets the value as a []map[string]interface{}. -// -// Panics if the object is not a []map[string]interface{}. -func (v *Value) MustMSISlice() []map[string]interface{} { - return v.data.([]map[string]interface{}) -} - -// IsMSI gets whether the object contained is a map[string]interface{} or not. -func (v *Value) IsMSI() bool { - _, ok := v.data.(map[string]interface{}) - return ok -} - -// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. -func (v *Value) IsMSISlice() bool { - _, ok := v.data.([]map[string]interface{}) - return ok -} - -// EachMSI calls the specified callback for each object -// in the []map[string]interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { - for index, val := range v.MustMSISlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereMSI uses the specified decider function to select items -// from the []map[string]interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { - var selected []map[string]interface{} - v.EachMSI(func(index int, val map[string]interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupMSI uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]map[string]interface{}. -func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { - groups := make(map[string][]map[string]interface{}) - v.EachMSI(func(index int, val map[string]interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]map[string]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceMSI uses the specified function to replace each map[string]interface{}s -// by iterating each item. The data in the returned result will be a -// []map[string]interface{} containing the replaced items. -func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { - arr := v.MustMSISlice() - replaced := make([]map[string]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectMSI uses the specified collector function to collect a value -// for each of the map[string]interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { - arr := v.MustMSISlice() - collected := make([]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - ObjxMap ((Map) and [](Map)) -*/ - -// ObjxMap gets the value as a (Map), returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { - if s, ok := v.data.((Map)); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return New(nil) -} - -// MustObjxMap gets the value as a (Map). -// -// Panics if the object is not a (Map). -func (v *Value) MustObjxMap() Map { - return v.data.((Map)) -} - -// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault -// value or nil if the value is not a [](Map). -func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { - if s, ok := v.data.([](Map)); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustObjxMapSlice gets the value as a [](Map). -// -// Panics if the object is not a [](Map). -func (v *Value) MustObjxMapSlice() [](Map) { - return v.data.([](Map)) -} - -// IsObjxMap gets whether the object contained is a (Map) or not. -func (v *Value) IsObjxMap() bool { - _, ok := v.data.((Map)) - return ok -} - -// IsObjxMapSlice gets whether the object contained is a [](Map) or not. -func (v *Value) IsObjxMapSlice() bool { - _, ok := v.data.([](Map)) - return ok -} - -// EachObjxMap calls the specified callback for each object -// in the [](Map). -// -// Panics if the object is the wrong type. -func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { - for index, val := range v.MustObjxMapSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereObjxMap uses the specified decider function to select items -// from the [](Map). The object contained in the result will contain -// only the selected items. -func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { - var selected [](Map) - v.EachObjxMap(func(index int, val Map) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupObjxMap uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][](Map). -func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { - groups := make(map[string][](Map)) - v.EachObjxMap(func(index int, val Map) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([](Map), 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceObjxMap uses the specified function to replace each (Map)s -// by iterating each item. The data in the returned result will be a -// [](Map) containing the replaced items. -func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { - arr := v.MustObjxMapSlice() - replaced := make([](Map), len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectObjxMap uses the specified collector function to collect a value -// for each of the (Map)s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { - arr := v.MustObjxMapSlice() - collected := make([]interface{}, len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Bool (bool and []bool) + Bool (bool and []bool) */ // Bool gets the value as a bool, returns the optionalDefault @@ -501,7 +251,7 @@ func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value { } /* - Str (string and []string) + Str (string and []string) */ // Str gets the value as a string, returns the optionalDefault @@ -626,7 +376,7 @@ func (v *Value) CollectStr(collector func(int, string) interface{}) *Value { } /* - Int (int and []int) + Int (int and []int) */ // Int gets the value as a int, returns the optionalDefault @@ -751,7 +501,7 @@ func (v *Value) CollectInt(collector func(int, int) interface{}) *Value { } /* - Int8 (int8 and []int8) + Int8 (int8 and []int8) */ // Int8 gets the value as a int8, returns the optionalDefault @@ -876,7 +626,7 @@ func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value { } /* - Int16 (int16 and []int16) + Int16 (int16 and []int16) */ // Int16 gets the value as a int16, returns the optionalDefault @@ -1001,7 +751,7 @@ func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value { } /* - Int32 (int32 and []int32) + Int32 (int32 and []int32) */ // Int32 gets the value as a int32, returns the optionalDefault @@ -1126,7 +876,7 @@ func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value { } /* - Int64 (int64 and []int64) + Int64 (int64 and []int64) */ // Int64 gets the value as a int64, returns the optionalDefault @@ -1251,7 +1001,7 @@ func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value { } /* - Uint (uint and []uint) + Uint (uint and []uint) */ // Uint gets the value as a uint, returns the optionalDefault @@ -1376,7 +1126,7 @@ func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value { } /* - Uint8 (uint8 and []uint8) + Uint8 (uint8 and []uint8) */ // Uint8 gets the value as a uint8, returns the optionalDefault @@ -1501,7 +1251,7 @@ func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value { } /* - Uint16 (uint16 and []uint16) + Uint16 (uint16 and []uint16) */ // Uint16 gets the value as a uint16, returns the optionalDefault @@ -1626,7 +1376,7 @@ func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value { } /* - Uint32 (uint32 and []uint32) + Uint32 (uint32 and []uint32) */ // Uint32 gets the value as a uint32, returns the optionalDefault @@ -1751,7 +1501,7 @@ func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value { } /* - Uint64 (uint64 and []uint64) + Uint64 (uint64 and []uint64) */ // Uint64 gets the value as a uint64, returns the optionalDefault @@ -1876,7 +1626,7 @@ func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value { } /* - Uintptr (uintptr and []uintptr) + Uintptr (uintptr and []uintptr) */ // Uintptr gets the value as a uintptr, returns the optionalDefault @@ -2001,7 +1751,7 @@ func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value } /* - Float32 (float32 and []float32) + Float32 (float32 and []float32) */ // Float32 gets the value as a float32, returns the optionalDefault @@ -2126,7 +1876,7 @@ func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value } /* - Float64 (float64 and []float64) + Float64 (float64 and []float64) */ // Float64 gets the value as a float64, returns the optionalDefault @@ -2251,7 +2001,7 @@ func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value } /* - Complex64 (complex64 and []complex64) + Complex64 (complex64 and []complex64) */ // Complex64 gets the value as a complex64, returns the optionalDefault @@ -2376,7 +2126,7 @@ func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Va } /* - Complex128 (complex128 and []complex128) + Complex128 (complex128 and []complex128) */ // Complex128 gets the value as a complex128, returns the optionalDefault diff --git a/backend/vendor/github.com/stretchr/objx/value.go b/backend/vendor/github.com/stretchr/objx/value.go index e4b4a143..4e5f9b77 100644 --- a/backend/vendor/github.com/stretchr/objx/value.go +++ b/backend/vendor/github.com/stretchr/objx/value.go @@ -20,6 +20,8 @@ func (v *Value) Data() interface{} { // String returns the value always as a string func (v *Value) String() string { switch { + case v.IsNil(): + return "" case v.IsStr(): return v.Str() case v.IsBool(): @@ -51,3 +53,107 @@ func (v *Value) String() string { } return fmt.Sprintf("%#v", v.Data()) } + +// StringSlice returns the value always as a []string +func (v *Value) StringSlice(optionalDefault ...[]string) []string { + switch { + case v.IsStrSlice(): + return v.MustStrSlice() + case v.IsBoolSlice(): + slice := v.MustBoolSlice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatBool(iv) + } + return vals + case v.IsFloat32Slice(): + slice := v.MustFloat32Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatFloat(float64(iv), 'f', -1, 32) + } + return vals + case v.IsFloat64Slice(): + slice := v.MustFloat64Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatFloat(iv, 'f', -1, 64) + } + return vals + case v.IsIntSlice(): + slice := v.MustIntSlice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatInt(int64(iv), 10) + } + return vals + case v.IsInt8Slice(): + slice := v.MustInt8Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatInt(int64(iv), 10) + } + return vals + case v.IsInt16Slice(): + slice := v.MustInt16Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatInt(int64(iv), 10) + } + return vals + case v.IsInt32Slice(): + slice := v.MustInt32Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatInt(int64(iv), 10) + } + return vals + case v.IsInt64Slice(): + slice := v.MustInt64Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatInt(iv, 10) + } + return vals + case v.IsUintSlice(): + slice := v.MustUintSlice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatUint(uint64(iv), 10) + } + return vals + case v.IsUint8Slice(): + slice := v.MustUint8Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatUint(uint64(iv), 10) + } + return vals + case v.IsUint16Slice(): + slice := v.MustUint16Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatUint(uint64(iv), 10) + } + return vals + case v.IsUint32Slice(): + slice := v.MustUint32Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatUint(uint64(iv), 10) + } + return vals + case v.IsUint64Slice(): + slice := v.MustUint64Slice() + vals := make([]string, len(slice)) + for i, iv := range slice { + vals[i] = strconv.FormatUint(iv, 10) + } + return vals + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + + return []string{} +} diff --git a/backend/vendor/github.com/umputun/go-flags/go.mod b/backend/vendor/github.com/umputun/go-flags/go.mod deleted file mode 100644 index 31425fa0..00000000 --- a/backend/vendor/github.com/umputun/go-flags/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/umputun/go-flags - -go 1.12 diff --git a/backend/vendor/github.com/umputun/go-flags/termsize.go b/backend/vendor/github.com/umputun/go-flags/termsize.go deleted file mode 100644 index 29b1110b..00000000 --- a/backend/vendor/github.com/umputun/go-flags/termsize.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build !windows,!plan9,!solaris,!appengine,!wasm - -package flags - -import ( - "syscall" - "unsafe" -) - -type winsize struct { - row, col uint16 - xpixel, ypixel uint16 -} - -func getTerminalColumns() int { - ws := winsize{} - - if tIOCGWINSZ != 0 { - syscall.Syscall(syscall.SYS_IOCTL, - uintptr(0), - uintptr(tIOCGWINSZ), - uintptr(unsafe.Pointer(&ws))) - - return int(ws.col) - } - - return 80 -} diff --git a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_bsdish.go b/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_bsdish.go deleted file mode 100644 index fcc11860..00000000 --- a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_bsdish.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build darwin freebsd netbsd openbsd - -package flags - -const ( - tIOCGWINSZ = 0x40087468 -) diff --git a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_linux.go b/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_linux.go deleted file mode 100644 index e3975e28..00000000 --- a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_linux.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build linux - -package flags - -const ( - tIOCGWINSZ = 0x5413 -) diff --git a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_other.go b/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_other.go deleted file mode 100644 index 30821515..00000000 --- a/backend/vendor/github.com/umputun/go-flags/tiocgwinsz_other.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !darwin,!freebsd,!netbsd,!openbsd,!linux - -package flags - -const ( - tIOCGWINSZ = 0 -) diff --git a/backend/vendor/github.com/xdg-go/scram/CHANGELOG.md b/backend/vendor/github.com/xdg-go/scram/CHANGELOG.md index 425c122f..5371fd4b 100644 --- a/backend/vendor/github.com/xdg-go/scram/CHANGELOG.md +++ b/backend/vendor/github.com/xdg-go/scram/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v1.1.0 - 2022-01-16 + +- Add SHA-512 hash generator function for convenience. + ## v1.0.2 - 2021-03-28 - Switch PBKDF2 dependency to github.com/xdg-go/pbkdf2 to diff --git a/backend/vendor/github.com/xdg-go/scram/doc.go b/backend/vendor/github.com/xdg-go/scram/doc.go index d43bee60..82e8aeed 100644 --- a/backend/vendor/github.com/xdg-go/scram/doc.go +++ b/backend/vendor/github.com/xdg-go/scram/doc.go @@ -10,14 +10,16 @@ // // Usage // -// The scram package provides two variables, `SHA1` and `SHA256`, that are -// used to construct Client or Server objects. +// The scram package provides variables, `SHA1`, `SHA256`, and `SHA512`, that +// are used to construct Client or Server objects. // // clientSHA1, err := scram.SHA1.NewClient(username, password, authID) // clientSHA256, err := scram.SHA256.NewClient(username, password, authID) +// clientSHA512, err := scram.SHA512.NewClient(username, password, authID) // // serverSHA1, err := scram.SHA1.NewServer(credentialLookupFcn) // serverSHA256, err := scram.SHA256.NewServer(credentialLookupFcn) +// serverSHA512, err := scram.SHA512.NewServer(credentialLookupFcn) // // These objects are used to construct ClientConversation or // ServerConversation objects that are used to carry out authentication. diff --git a/backend/vendor/github.com/xdg-go/scram/scram.go b/backend/vendor/github.com/xdg-go/scram/scram.go index 92765996..a7b36602 100644 --- a/backend/vendor/github.com/xdg-go/scram/scram.go +++ b/backend/vendor/github.com/xdg-go/scram/scram.go @@ -9,6 +9,7 @@ package scram import ( "crypto/sha1" "crypto/sha256" + "crypto/sha512" "fmt" "hash" @@ -29,6 +30,10 @@ var SHA1 HashGeneratorFcn = func() hash.Hash { return sha1.New() } // to create Client objects configured for SHA-256 hashing. var SHA256 HashGeneratorFcn = func() hash.Hash { return sha256.New() } +// SHA512 is a function that returns a crypto/sha512 hasher and should be used +// to create Client objects configured for SHA-512 hashing. +var SHA512 HashGeneratorFcn = func() hash.Hash { return sha512.New() } + // NewClient constructs a SCRAM client component based on a given hash.Hash // factory receiver. This constructor will normalize the username, password // and authzID via the SASLprep algorithm, as recommended by RFC-5802. If diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bson.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bson.go index 0c739dd0..95ffc107 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bson.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bson.go @@ -7,8 +7,6 @@ // Based on gopkg.in/mgo.v2/bson by Gustavo Niemeyer // See THIRD-PARTY-NOTICES for original license terms. -// +build go1.9 - package bson // import "go.mongodb.org/mongo-driver/bson" import ( diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bson_1_8.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bson_1_8.go deleted file mode 100644 index bbe77928..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bson_1_8.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (C) MongoDB, Inc. 2017-present. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -// +build !go1.9 - -package bson // import "go.mongodb.org/mongo-driver/bson" - -import ( - "math" - "strconv" - "strings" -) - -// Zeroer allows custom struct types to implement a report of zero -// state. All struct types that don't implement Zeroer or where IsZero -// returns false are considered to be not zero. -type Zeroer interface { - IsZero() bool -} - -// D is an ordered representation of a BSON document. This type should be used when the order of the elements matters, -// such as MongoDB command documents. If the order of the elements does not matter, an M should be used instead. -// -// Example usage: -// -// bson.D{{"foo", "bar"}, {"hello", "world"}, {"pi", 3.14159}} -type D []E - -// Map creates a map from the elements of the D. -func (d D) Map() M { - m := make(M, len(d)) - for _, e := range d { - m[e.Key] = e.Value - } - return m -} - -// E represents a BSON element for a D. It is usually used inside a D. -type E struct { - Key string - Value interface{} -} - -// M is an unordered representation of a BSON document. This type should be used when the order of the elements does not -// matter. This type is handled as a regular map[string]interface{} when encoding and decoding. Elements will be -// serialized in an undefined, random order. If the order of the elements matters, a D should be used instead. -// -// Example usage: -// -// bson.M{"foo": "bar", "hello": "world", "pi": 3.14159} -type M map[string]interface{} - -// An A is an ordered representation of a BSON array. -// -// Example usage: -// -// bson.A{"bar", "world", 3.14159, bson.D{{"qux", 12345}}} -type A []interface{} - -func formatDouble(f float64) string { - var s string - if math.IsInf(f, 1) { - s = "Infinity" - } else if math.IsInf(f, -1) { - s = "-Infinity" - } else if math.IsNaN(f) { - s = "NaN" - } else { - // Print exactly one decimalType place for integers; otherwise, print as many are necessary to - // perfectly represent it. - s = strconv.FormatFloat(f, 'G', -1, 64) - if !strings.ContainsRune(s, '.') { - s += ".0" - } - } - - return s -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_encoders.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_encoders.go index 49a0c3f1..6bdb43cb 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_encoders.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/default_value_encoders.go @@ -30,7 +30,7 @@ var errInvalidValue = errors.New("cannot encode invalid element") var sliceWriterPool = sync.Pool{ New: func() interface{} { - sw := make(bsonrw.SliceWriter, 0, 0) + sw := make(bsonrw.SliceWriter, 0) return &sw }, } @@ -333,14 +333,7 @@ func (dve DefaultValueEncoders) mapEncodeValue(ec EncodeContext, dw bsonrw.Docum continue } - if enc, ok := currEncoder.(ValueEncoder); ok { - err = enc.EncodeValue(ec, vw, currVal) - if err != nil { - return err - } - continue - } - err = encoder.EncodeValue(ec, vw, currVal) + err = currEncoder.EncodeValue(ec, vw, currVal) if err != nil { return err } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/map_codec.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/map_codec.go index fbb8ef42..1f7acbcf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/map_codec.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/map_codec.go @@ -126,14 +126,7 @@ func (mc *MapCodec) mapEncodeValue(ec EncodeContext, dw bsonrw.DocumentWriter, v continue } - if enc, ok := currEncoder.(ValueEncoder); ok { - err = enc.EncodeValue(ec, vw, currVal) - if err != nil { - return err - } - continue - } - err = encoder.EncodeValue(ec, vw, currVal) + err = currEncoder.EncodeValue(ec, vw, currVal) if err != nil { return err } @@ -265,17 +258,15 @@ func (mc *MapCodec) decodeKey(key string, keyType reflect.Type) (reflect.Value, case reflect.String: keyVal = reflect.ValueOf(key).Convert(keyType) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - s := string(key) - n, parseErr := strconv.ParseInt(s, 10, 64) + n, parseErr := strconv.ParseInt(key, 10, 64) if parseErr != nil || reflect.Zero(keyType).OverflowInt(n) { - err = fmt.Errorf("failed to unmarshal number key %v", s) + err = fmt.Errorf("failed to unmarshal number key %v", key) } keyVal = reflect.ValueOf(n).Convert(keyType) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - s := string(key) - n, parseErr := strconv.ParseUint(s, 10, 64) + n, parseErr := strconv.ParseUint(key, 10, 64) if parseErr != nil || reflect.Zero(keyType).OverflowUint(n) { - err = fmt.Errorf("failed to unmarshal number key %v", s) + err = fmt.Errorf("failed to unmarshal number key %v", key) break } keyVal = reflect.ValueOf(n).Convert(keyType) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go index 60abffb2..02b9341f 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/registry.go @@ -54,12 +54,6 @@ func (entme ErrNoTypeMapEntry) Error() string { // ErrNotInterface is returned when the provided type is not an interface. var ErrNotInterface = errors.New("The provided type is not an interface") -var defaultRegistry *Registry - -func init() { - defaultRegistry = buildDefaultRegistry() -} - // A RegistryBuilder is used to build a Registry. This type is not goroutine // safe. type RegistryBuilder struct { @@ -374,7 +368,7 @@ func (r *Registry) lookupInterfaceEncoder(t reflect.Type, allowAddr bool) (Value // in interfaceEncoders defaultEnc, found := r.lookupInterfaceEncoder(t, false) if !found { - defaultEnc, _ = r.kindEncoders[t.Kind()] + defaultEnc = r.kindEncoders[t.Kind()] } return newCondAddrEncoder(ienc.ve, defaultEnc), true } @@ -445,7 +439,7 @@ func (r *Registry) lookupInterfaceDecoder(t reflect.Type, allowAddr bool) (Value // in interfaceDecoders defaultDec, found := r.lookupInterfaceDecoder(t, false) if !found { - defaultDec, _ = r.kindDecoders[t.Kind()] + defaultDec = r.kindDecoders[t.Kind()] } return newCondAddrDecoder(idec.vd, defaultDec), true } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go index 9ce90178..be3f2081 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/struct_codec.go @@ -331,14 +331,7 @@ func (sc *StructCodec) DecodeValue(r DecodeContext, vr bsonrw.ValueReader, val r return newDecodeError(fd.name, ErrNoDecoder{Type: field.Elem().Type()}) } - if decoder, ok := fd.decoder.(ValueDecoder); ok { - err = decoder.DecodeValue(dctx, vr, field.Elem()) - if err != nil { - return newDecodeError(fd.name, err) - } - continue - } - err = fd.decoder.DecodeValue(dctx, vr, field) + err = fd.decoder.DecodeValue(dctx, vr, field.Elem()) if err != nil { return newDecodeError(fd.name, err) } @@ -567,7 +560,7 @@ func (sc *StructCodec) describeStruct(r *Registry, t reflect.Type) (*structDescr } dominant, ok := dominantField(fields[i : i+advance]) if !ok || !sc.OverwriteDuplicatedInlinedFields { - return nil, fmt.Errorf("struct %s) duplicated key %s", t.String(), name) + return nil, fmt.Errorf("struct %s has duplicated key %s", t.String(), name) } sd.fl = append(sd.fl, dominant) sd.fm[name] = dominant diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/types.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/types.go index fb5b5108..07f4b70e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/types.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsoncodec/types.go @@ -16,36 +16,12 @@ import ( "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" ) -var ptBool = reflect.TypeOf((*bool)(nil)) -var ptInt8 = reflect.TypeOf((*int8)(nil)) -var ptInt16 = reflect.TypeOf((*int16)(nil)) -var ptInt32 = reflect.TypeOf((*int32)(nil)) -var ptInt64 = reflect.TypeOf((*int64)(nil)) -var ptInt = reflect.TypeOf((*int)(nil)) -var ptUint8 = reflect.TypeOf((*uint8)(nil)) -var ptUint16 = reflect.TypeOf((*uint16)(nil)) -var ptUint32 = reflect.TypeOf((*uint32)(nil)) -var ptUint64 = reflect.TypeOf((*uint64)(nil)) -var ptUint = reflect.TypeOf((*uint)(nil)) -var ptFloat32 = reflect.TypeOf((*float32)(nil)) -var ptFloat64 = reflect.TypeOf((*float64)(nil)) -var ptString = reflect.TypeOf((*string)(nil)) - var tBool = reflect.TypeOf(false) -var tFloat32 = reflect.TypeOf(float32(0)) var tFloat64 = reflect.TypeOf(float64(0)) -var tInt = reflect.TypeOf(int(0)) -var tInt8 = reflect.TypeOf(int8(0)) -var tInt16 = reflect.TypeOf(int16(0)) var tInt32 = reflect.TypeOf(int32(0)) var tInt64 = reflect.TypeOf(int64(0)) var tString = reflect.TypeOf("") var tTime = reflect.TypeOf(time.Time{}) -var tUint = reflect.TypeOf(uint(0)) -var tUint8 = reflect.TypeOf(uint8(0)) -var tUint16 = reflect.TypeOf(uint16(0)) -var tUint32 = reflect.TypeOf(uint32(0)) -var tUint64 = reflect.TypeOf(uint64(0)) var tEmpty = reflect.TypeOf((*interface{})(nil)).Elem() var tByteSlice = reflect.TypeOf([]byte(nil)) @@ -74,7 +50,6 @@ var tDecimal = reflect.TypeOf(primitive.Decimal128{}) var tMinKey = reflect.TypeOf(primitive.MinKey{}) var tMaxKey = reflect.TypeOf(primitive.MaxKey{}) var tD = reflect.TypeOf(primitive.D{}) -var tM = reflect.TypeOf(primitive.M{}) var tA = reflect.TypeOf(primitive.A{}) var tE = reflect.TypeOf(primitive.E{}) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go index 3af6fcf0..96957042 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_wrappers.go @@ -19,7 +19,7 @@ import ( ) func wrapperKeyBSONType(key string) bsontype.Type { - switch string(key) { + switch key { case "$numberInt": return bsontype.Int32 case "$numberLong": @@ -269,7 +269,7 @@ func (ejv *extJSONValue) parseDouble() (float64, error) { return 0, fmt.Errorf("$numberDouble value should be string, but instead is %s", ejv.t) } - switch string(ejv.v.(string)) { + switch ejv.v.(string) { case "Infinity": return math.Inf(1), nil case "-Infinity": @@ -364,7 +364,7 @@ func (ejv *extJSONValue) parseRegex() (pattern, options string, err error) { for i, key := range regexObj.keys { val := regexObj.values[i] - switch string(key) { + switch key { case "pattern": if patFound { return "", "", errors.New("duplicate pattern key in $regularExpression") diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_writer.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_writer.go index 605e41a1..99ed524b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_writer.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/extjson_writer.go @@ -10,7 +10,6 @@ import ( "bytes" "encoding/base64" "fmt" - "go.mongodb.org/mongo-driver/bson/primitive" "io" "math" "sort" @@ -19,13 +18,9 @@ import ( "sync" "time" "unicode/utf8" -) -var ejvwPool = sync.Pool{ - New: func() interface{} { - return new(extJSONValueWriter) - }, -} + "go.mongodb.org/mongo-driver/bson/primitive" +) // ExtJSONValueWriterPool is a pool for ExtJSON ValueWriters. type ExtJSONValueWriterPool struct { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_reader.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_reader.go index 55378093..5e147373 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_reader.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/value_reader.go @@ -790,16 +790,6 @@ func (vr *valueReader) readCString() (string, error) { return string(vr.d[start : start+int64(idx)]), nil } -func (vr *valueReader) skipCString() error { - idx := bytes.IndexByte(vr.d[vr.offset:], 0x00) - if idx < 0 { - return io.EOF - } - // idx does not include the null byte - vr.offset += int64(idx) + 1 - return nil -} - func (vr *valueReader) readString() (string, error) { length, err := vr.readLength() if err != nil { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/writer.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/writer.go index 7644df12..dff65f87 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/writer.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsonrw/writer.go @@ -76,27 +76,3 @@ func (sw *SliceWriter) Write(p []byte) (int, error) { *sw = append(*sw, p...) return written, nil } - -type writer []byte - -func (w *writer) Write(p []byte) (int, error) { - index := len(*w) - return w.WriteAt(p, int64(index)) -} - -func (w *writer) WriteAt(p []byte, off int64) (int, error) { - newend := off + int64(len(p)) - if newend < int64(len(*w)) { - newend = int64(len(*w)) - } - - if newend > int64(cap(*w)) { - buf := make([]byte, int64(2*cap(*w))+newend) - copy(buf, *w) - *w = buf - } - - *w = []byte(*w)[:newend] - copy([]byte(*w)[off:], p) - return len(p), nil -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsontype/bsontype.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsontype/bsontype.go index 63a59ca0..7c91ae51 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/bsontype/bsontype.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/bsontype/bsontype.go @@ -38,6 +38,8 @@ const ( BinaryUUIDOld byte = 0x03 BinaryUUID byte = 0x04 BinaryMD5 byte = 0x05 + BinaryEncrypted byte = 0x06 + BinaryColumn byte = 0x07 BinaryUserDefined byte = 0x80 ) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go index 8d8fc8ce..79f03858 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/marshal.go @@ -7,6 +7,9 @@ package bson import ( + "bytes" + "encoding/json" + "go.mongodb.org/mongo-driver/bson/bsoncodec" "go.mongodb.org/mongo-driver/bson/bsonrw" "go.mongodb.org/mongo-driver/bson/bsontype" @@ -221,3 +224,22 @@ func MarshalExtJSONAppendWithContext(ec bsoncodec.EncodeContext, dst []byte, val return *sw, nil } + +func IndentExtJSON(dst *bytes.Buffer, src []byte, prefix, indent string) error { + return json.Indent(dst, src, prefix, indent) +} + +func MarshalExtJSONIndent(val interface{}, canonical, escapeHTML bool, prefix, indent string) ([]byte, error) { + marshaled, err := MarshalExtJSON(val, canonical, escapeHTML) + if err != nil { + return nil, err + } + + var buf bytes.Buffer + err = IndentExtJSON(&buf, marshaled, prefix, indent) + if err != nil { + return nil, err + } + + return buf.Bytes(), nil +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go index a57e1d69..ffe4eed0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/decimal.go @@ -133,11 +133,9 @@ Loop: } // BigInt returns significand as big.Int and exponent, bi * 10 ^ exp. -func (d Decimal128) BigInt() (bi *big.Int, exp int, err error) { +func (d Decimal128) BigInt() (*big.Int, int, error) { high, low := d.GetBytes() - var posSign bool // positive sign - - posSign = high>>63&1 == 0 + posSign := high>>63&1 == 0 // positive sign switch high >> 58 & (1<<5 - 1) { case 0x1F: @@ -149,6 +147,7 @@ func (d Decimal128) BigInt() (bi *big.Int, exp int, err error) { return nil, 0, ErrParseNegInf } + var exp int if high>>61&3 == 3 { // Bits: 1*sign 2*ignored 14*exponent 111*significand. // Implicit 0b100 prefix in significand. @@ -171,7 +170,7 @@ func (d Decimal128) BigInt() (bi *big.Int, exp int, err error) { return new(big.Int), 0, nil } - bi = big.NewInt(0) + bi := big.NewInt(0) const host32bit = ^uint(0)>>32 == 0 if host32bit { bi.SetBits([]big.Word{big.Word(low), big.Word(low >> 32), big.Word(high), big.Word(high >> 32)}) @@ -182,7 +181,7 @@ func (d Decimal128) BigInt() (bi *big.Int, exp int, err error) { if !posSign { return bi.Neg(bi), exp, nil } - return + return bi, exp, nil } // IsNaN returns whether d is NaN. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go index a5a7d7c6..652898fe 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go @@ -10,8 +10,8 @@ package primitive import ( - "bytes" "crypto/rand" + "encoding" "encoding/binary" "encoding/hex" "encoding/json" @@ -34,6 +34,9 @@ var NilObjectID ObjectID var objectIDCounter = readRandomUint32() var processUnique = processUniqueBytes() +var _ encoding.TextMarshaler = ObjectID{} +var _ encoding.TextUnmarshaler = &ObjectID{} + // NewObjectID generates a new ObjectID. func NewObjectID() ObjectID { return NewObjectIDFromTimestamp(time.Now()) @@ -67,7 +70,7 @@ func (id ObjectID) String() string { // IsZero returns true if id is the empty ObjectID. func (id ObjectID) IsZero() bool { - return bytes.Equal(id[:], NilObjectID[:]) + return id == NilObjectID } // ObjectIDFromHex creates a new ObjectID from a hex string. It returns an error if the hex string is not a @@ -83,7 +86,7 @@ func ObjectIDFromHex(s string) (ObjectID, error) { } var oid [12]byte - copy(oid[:], b[:]) + copy(oid[:], b) return oid, nil } @@ -94,6 +97,23 @@ func IsValidObjectID(s string) bool { return err == nil } +// MarshalText returns the ObjectID as UTF-8-encoded text. Implementing this allows us to use ObjectID +// as a map key when marshalling JSON. See https://pkg.go.dev/encoding#TextMarshaler +func (id ObjectID) MarshalText() ([]byte, error) { + return []byte(id.Hex()), nil +} + +// UnmarshalText populates the byte slice with the ObjectID. Implementing this allows us to use ObjectID +// as a map key when unmarshalling JSON. See https://pkg.go.dev/encoding#TextUnmarshaler +func (id *ObjectID) UnmarshalText(b []byte) error { + oid, err := ObjectIDFromHex(string(b)) + if err != nil { + return err + } + *id = oid + return nil +} + // MarshalJSON returns the ObjectID as a string func (id ObjectID) MarshalJSON() ([]byte, error) { return json.Marshal(id.Hex()) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go index 51984e22..b3cba1bf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive/primitive.go @@ -111,7 +111,7 @@ func (d DBPointer) String() string { // Equal compares d to d2 and returns true if they are equal. func (d DBPointer) Equal(d2 DBPointer) bool { - return d.DB == d2.DB && bytes.Equal(d.Pointer[:], d2.Pointer[:]) + return d == d2 } // IsZero returns if d is the empty DBPointer. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive_codecs.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive_codecs.go index f397fa2d..1cbe3884 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive_codecs.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/primitive_codecs.go @@ -14,6 +14,9 @@ import ( "go.mongodb.org/mongo-driver/bson/bsonrw" ) +var tRawValue = reflect.TypeOf(RawValue{}) +var tRaw = reflect.TypeOf(Raw(nil)) + var primitiveCodecs PrimitiveCodecs // PrimitiveCodecs is a namespace for all of the default bsoncodec.Codecs for the primitive types @@ -87,25 +90,3 @@ func (PrimitiveCodecs) RawDecodeValue(dc bsoncodec.DecodeContext, vr bsonrw.Valu val.Set(reflect.ValueOf(rdr)) return err } - -func (pc PrimitiveCodecs) encodeRaw(ec bsoncodec.EncodeContext, dw bsonrw.DocumentWriter, raw Raw) error { - var copier bsonrw.Copier - elems, err := raw.Elements() - if err != nil { - return err - } - for _, elem := range elems { - dvw, err := dw.WriteDocumentElement(elem.Key()) - if err != nil { - return err - } - - val := elem.Value() - err = copier.CopyValueFromBytes(dvw, val.Type, val.Value) - if err != nil { - return err - } - } - - return dw.WriteDocumentEnd() -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/raw.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/raw.go index 2aae9f56..efd705da 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/raw.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/raw.go @@ -15,7 +15,6 @@ import ( // ErrNilReader indicates that an operation was attempted on a nil bson.Reader. var ErrNilReader = errors.New("nil reader") -var errValidateDone = errors.New("validation loop complete") // Raw is a wrapper around a byte slice. It will interpret the slice as a // BSON document. This type is a wrapper around a bsoncore.Document. Errors returned from the @@ -84,9 +83,3 @@ func (r Raw) IndexErr(index uint) (RawElement, error) { // String implements the fmt.Stringer interface. func (r Raw) String() string { return bsoncore.Document(r).String() } - -// readi32 is a helper function for reading an int32 from slice of bytes. -func readi32(b []byte) int32 { - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return int32(b[0]) | int32(b[1])<<8 | int32(b[2])<<16 | int32(b[3])<<24 -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/bson/types.go b/backend/vendor/go.mongodb.org/mongo-driver/bson/types.go index bf91f691..13a1c35c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/bson/types.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/bson/types.go @@ -7,11 +7,7 @@ package bson import ( - "reflect" - "time" - "go.mongodb.org/mongo-driver/bson/bsontype" - "go.mongodb.org/mongo-driver/bson/primitive" ) // These constants uniquely refer to each BSON type. @@ -38,48 +34,3 @@ const ( TypeMinKey = bsontype.MinKey TypeMaxKey = bsontype.MaxKey ) - -var tBinary = reflect.TypeOf(primitive.Binary{}) -var tBool = reflect.TypeOf(false) -var tCodeWithScope = reflect.TypeOf(primitive.CodeWithScope{}) -var tDBPointer = reflect.TypeOf(primitive.DBPointer{}) -var tDecimal = reflect.TypeOf(primitive.Decimal128{}) -var tD = reflect.TypeOf(D{}) -var tA = reflect.TypeOf(A{}) -var tDateTime = reflect.TypeOf(primitive.DateTime(0)) -var tUndefined = reflect.TypeOf(primitive.Undefined{}) -var tNull = reflect.TypeOf(primitive.Null{}) -var tRawValue = reflect.TypeOf(RawValue{}) -var tFloat32 = reflect.TypeOf(float32(0)) -var tFloat64 = reflect.TypeOf(float64(0)) -var tInt = reflect.TypeOf(int(0)) -var tInt8 = reflect.TypeOf(int8(0)) -var tInt16 = reflect.TypeOf(int16(0)) -var tInt32 = reflect.TypeOf(int32(0)) -var tInt64 = reflect.TypeOf(int64(0)) -var tJavaScript = reflect.TypeOf(primitive.JavaScript("")) -var tOID = reflect.TypeOf(primitive.ObjectID{}) -var tRaw = reflect.TypeOf(Raw(nil)) -var tRegex = reflect.TypeOf(primitive.Regex{}) -var tString = reflect.TypeOf("") -var tSymbol = reflect.TypeOf(primitive.Symbol("")) -var tTime = reflect.TypeOf(time.Time{}) -var tTimestamp = reflect.TypeOf(primitive.Timestamp{}) -var tUint = reflect.TypeOf(uint(0)) -var tUint8 = reflect.TypeOf(uint8(0)) -var tUint16 = reflect.TypeOf(uint16(0)) -var tUint32 = reflect.TypeOf(uint32(0)) -var tUint64 = reflect.TypeOf(uint64(0)) -var tMinKey = reflect.TypeOf(primitive.MinKey{}) -var tMaxKey = reflect.TypeOf(primitive.MaxKey{}) - -var tEmpty = reflect.TypeOf((*interface{})(nil)).Elem() -var tEmptySlice = reflect.TypeOf([]interface{}(nil)) - -var zeroVal reflect.Value - -// this references the quantity of milliseconds between zero time and -// the unix epoch. useful for making sure that we convert time.Time -// objects correctly to match the legacy bson library's handling of -// time.Time values. -const zeroEpochMs = int64(62135596800000) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go b/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go index bc802f0f..d95deef0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/event/monitoring.go @@ -22,6 +22,9 @@ type CommandStartedEvent struct { CommandName string RequestID int64 ConnectionID string + // ServerConnectionID contains the connection ID from the server of the operation. If the server does not return + // this value (e.g. on MDB < 4.2), it is unset. + ServerConnectionID *int32 // ServiceID contains the ID of the server to which the command was sent if it is running behind a load balancer. // Otherwise, it is unset. ServiceID *primitive.ObjectID @@ -33,6 +36,9 @@ type CommandFinishedEvent struct { CommandName string RequestID int64 ConnectionID string + // ServerConnectionID contains the connection ID from the server of the operation. If the server does not return + // this value (e.g. on MDB < 4.2), it is unset. + ServerConnectionID *int32 // ServiceID contains the ID of the server to which the command was sent if it is running behind a load balancer. // Otherwise, it is unset. ServiceID *primitive.ObjectID diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go index 772053ad..f2d2d88d 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/internal/const.go @@ -13,3 +13,12 @@ var Version = "local build" // command responses by using the value of "topologyVersion.processId". This is used for testing load balancer support // until an upstream service can support running behind a load balancer. var SetMockServiceID = false + +// LegacyHello is the legacy version of the hello command. +var LegacyHello = "isMaster" + +// LegacyHelloLowercase is the lowercase, legacy version of the hello command. +var LegacyHelloLowercase = "ismaster" + +// LegacyNotPrimary is the legacy version of the "not primary" server error message. +var LegacyNotPrimary = "not master" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/randutil/randutil.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/randutil/randutil.go new file mode 100644 index 00000000..631f9532 --- /dev/null +++ b/backend/vendor/go.mongodb.org/mongo-driver/internal/randutil/randutil.go @@ -0,0 +1,54 @@ +// Package randutil provides common random number utilities. +package randutil + +import ( + "math/rand" + "sync" +) + +// A LockedRand wraps a "math/rand".Rand and is safe to use from multiple goroutines. +type LockedRand struct { + mu sync.Mutex + r *rand.Rand +} + +// NewLockedRand returns a new LockedRand that uses random values from src to generate other random +// values. It is safe to use from multiple goroutines. +func NewLockedRand(src rand.Source) *LockedRand { + return &LockedRand{ + // Ignore gosec warning "Use of weak random number generator (math/rand instead of + // crypto/rand)". We intentionally use a pseudo-random number generator. + /* #nosec G404 */ + r: rand.New(src), + } +} + +// Read generates len(p) random bytes and writes them into p. It always returns len(p) and a nil +// error. +func (lr *LockedRand) Read(p []byte) (int, error) { + lr.mu.Lock() + n, err := lr.r.Read(p) + lr.mu.Unlock() + return n, err +} + +// Intn returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n). It +// panics if n <= 0. +func (lr *LockedRand) Intn(n int) int { + lr.mu.Lock() + x := lr.r.Intn(n) + lr.mu.Unlock() + return x +} + +// Shuffle pseudo-randomizes the order of elements. n is the number of elements. Shuffle panics if +// n < 0. swap swaps the elements with indexes i and j. +// +// Note that Shuffle locks the LockedRand, so shuffling large collections may adversely affect other +// concurrent calls. If many concurrent Shuffle and random value calls are required, consider using +// the global "math/rand".Shuffle instead because it uses much more granular locking. +func (lr *LockedRand) Shuffle(n int, swap func(i, j int)) { + lr.mu.Lock() + lr.r.Shuffle(n, swap) + lr.mu.Unlock() +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/semaphore.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/semaphore.go deleted file mode 100644 index 792e531a..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/internal/semaphore.go +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) MongoDB, Inc. 2017-present. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -package internal - -import ( - "context" - "errors" -) - -// NewSemaphore creates a new semaphore. -func NewSemaphore(slots uint64) *Semaphore { - ch := make(chan struct{}, slots) - for i := uint64(0); i < slots; i++ { - ch <- struct{}{} - } - - return &Semaphore{ - permits: ch, - } -} - -// Semaphore is a synchronization primitive that controls access -// to a common resource. -type Semaphore struct { - permits chan struct{} -} - -// Len gets the number of permits available. -func (s *Semaphore) Len() uint64 { - return uint64(len(s.permits)) -} - -// Wait waits until a resource is available or until the context -// is done. -func (s *Semaphore) Wait(ctx context.Context) error { - select { - case <-s.permits: - return nil - case <-ctx.Done(): - return ctx.Err() - } -} - -// Release releases a resource back into the pool. -func (s *Semaphore) Release() error { - select { - case s.permits <- struct{}{}: - default: - return errors.New("internal.Semaphore.Release: attempt to release more resources than are available") - } - - return nil -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go b/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go index 8d1fcdc7..21e73002 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/internal/uri_validation_errors.go @@ -15,4 +15,8 @@ var ( ErrLoadBalancedWithReplicaSet = errors.New("loadBalanced cannot be set to true if a replica set name is specified") // ErrLoadBalancedWithDirectConnection is returned when loadBalanced=true is specified in a URI with the directConnection option. ErrLoadBalancedWithDirectConnection = errors.New("loadBalanced cannot be set to true if the direct connection option is specified") + // ErrSRVMaxHostsWithReplicaSet is returned when srvMaxHosts > 0 is specified in a URI with the replicaSet option. + ErrSRVMaxHostsWithReplicaSet = errors.New("srvMaxHosts cannot be a positive value if a replica set name is specified") + // ErrSRVMaxHostsWithLoadBalanced is returned when srvMaxHosts > 0 is specified in a URI with loadBalanced=true. + ErrSRVMaxHostsWithLoadBalanced = errors.New("srvMaxHosts cannot be a positive value if loadBalanced is set to true") ) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go index 56736a23..fb5c91a1 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/bulk_write.go @@ -59,11 +59,6 @@ func (bw *bulkWrite) execute(ctx context.Context) error { continue } - bypassDocValidation := bw.bypassDocumentValidation - if bypassDocValidation != nil && !*bypassDocValidation { - bypassDocValidation = nil - } - batchRes, batchErr, err := bw.runBatch(ctx, batch) bw.mergeResults(batchRes) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go index c10c0396..f2a194d7 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream.go @@ -38,7 +38,7 @@ var ( resumableErrorLabel = "ResumableChangeStreamError" errorCursorNotFound int32 = 43 // CursorNotFound error code - // Whitelist of error codes that are considered resumable. + // Allowlist of error codes that are considered resumable. resumableChangeStreamErrors = map[int32]struct{}{ 6: {}, // HostUnreachable 7: {}, // HostNotFound @@ -47,11 +47,11 @@ var ( 189: {}, // PrimarySteppedDown 262: {}, // ExceededTimeLimit 9001: {}, // SocketException - 10107: {}, // NotMaster + 10107: {}, // NotPrimary 11600: {}, // InterruptedAtShutdown 11602: {}, // InterruptedDueToReplStateChange - 13435: {}, // NotMasterNoSlaveOk - 13436: {}, // NotMasterOrSecondary + 13435: {}, // NotPrimaryNoSecondaryOK + 13436: {}, // NotPrimaryOrSecondary 63: {}, // StaleShardVersion 150: {}, // StaleEpoch 13388: {}, // StaleConfig @@ -94,7 +94,7 @@ type changeStreamConfig struct { streamType StreamType collectionName string databaseName string - crypt *driver.Crypt + crypt driver.Crypt } func newChangeStream(ctx context.Context, config changeStreamConfig, pipeline interface{}, @@ -141,7 +141,7 @@ func newChangeStream(ctx context.Context, config changeStreamConfig, pipeline in cs.cursorOptions.BatchSize = *cs.options.BatchSize } if cs.options.MaxAwaitTime != nil { - cs.cursorOptions.MaxTimeMS = int64(time.Duration(*cs.options.MaxAwaitTime) / time.Millisecond) + cs.cursorOptions.MaxTimeMS = int64(*cs.options.MaxAwaitTime / time.Millisecond) } switch cs.streamType { @@ -604,7 +604,7 @@ func (cs *ChangeStream) isResumableError() bool { return commandErr.HasErrorLabel(resumableErrorLabel) } - // For wire versions below 9, a server error is resumable if its code is on the whitelist. + // For wire versions below 9, a server error is resumable if its code is on the allowlist. _, resumable := resumableChangeStreamErrors[commandErr.Code] return resumable } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream_deployment.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream_deployment.go index 5ff82c5f..36c6e254 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream_deployment.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/change_stream_deployment.go @@ -8,6 +8,7 @@ package mongo import ( "context" + "time" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/mongo/driver" @@ -35,6 +36,10 @@ func (c *changeStreamDeployment) Connection(context.Context) (driver.Connection, return c.conn, nil } +func (c *changeStreamDeployment) MinRTT() time.Duration { + return c.server.MinRTT() +} + func (c *changeStreamDeployment) ProcessError(err error, conn driver.Connection) driver.ProcessErrorResult { ep, ok := c.server.(driver.ErrorProcessor) if !ok { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go index 4f429207..63630ebe 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client.go @@ -25,7 +25,6 @@ import ( "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver" "go.mongodb.org/mongo-driver/x/mongo/driver/auth" - "go.mongodb.org/mongo-driver/x/mongo/driver/connstring" "go.mongodb.org/mongo-driver/x/mongo/driver/ocsp" "go.mongodb.org/mongo-driver/x/mongo/driver/operation" "go.mongodb.org/mongo-driver/x/mongo/driver/session" @@ -52,7 +51,6 @@ type Client struct { id uuid.UUID topologyOptions []topology.Option deployment driver.Deployment - connString connstring.ConnString localThreshold time.Duration retryWrites bool retryReads bool @@ -61,7 +59,6 @@ type Client struct { readConcern *readconcern.ReadConcern writeConcern *writeconcern.WriteConcern registry *bsoncodec.Registry - marshaller BSONAppender monitor *event.CommandMonitor serverAPI *driver.ServerAPIOptions serverMonitor *event.ServerMonitor @@ -71,7 +68,7 @@ type Client struct { keyVaultClientFLE *Client keyVaultCollFLE *Collection mongocryptdFLE *mcryptClient - cryptFLE *driver.Crypt + cryptFLE driver.Crypt metadataClientFLE *Client internalClientFLE *Client } @@ -375,10 +372,22 @@ func (c *Client) configure(opts *options.ClientOptions) error { // ClusterClock c.clock = new(session.ClusterClock) - // Pass down URI so topology can determine whether or not SRV polling is required - topologyOpts = append(topologyOpts, topology.WithURI(func(uri string) string { - return opts.GetURI() - })) + // Pass down URI, SRV service name, and SRV max hosts so topology can poll SRV records correctly. + topologyOpts = append(topologyOpts, + topology.WithURI(func(uri string) string { return opts.GetURI() }), + topology.WithSRVServiceName(func(srvName string) string { + if opts.SRVServiceName != nil { + return *opts.SRVServiceName + } + return "" + }), + topology.WithSRVMaxHosts(func(srvMaxHosts int) int { + if opts.SRVMaxHosts != nil { + return *opts.SRVMaxHosts + } + return 0 + }), + ) // AppName var appName string @@ -425,7 +434,7 @@ func (c *Client) configure(opts *options.ClientOptions) error { // Handshaker var handshaker = func(driver.Handshaker) driver.Handshaker { - return operation.NewIsMaster().AppName(appName).Compressors(comps).ClusterClock(c.clock). + return operation.NewHello().AppName(appName).Compressors(comps).ClusterClock(c.clock). ServerAPI(c.serverAPI).LoadBalanced(loadBalanced) } // Auth & Database & Password & Username @@ -537,6 +546,13 @@ func (c *Client) configure(opts *options.ClientOptions) error { topology.WithMinConnections(func(uint64) uint64 { return *opts.MinPoolSize }), ) } + // MaxConnecting + if opts.MaxConnecting != nil { + serverOpts = append( + serverOpts, + topology.WithMaxConnecting(func(uint64) uint64 { return *opts.MaxConnecting }), + ) + } // PoolMonitor if opts.PoolMonitor != nil { serverOpts = append( @@ -625,6 +641,8 @@ func (c *Client) configure(opts *options.ClientOptions) error { if err := c.configureAutoEncryption(opts); err != nil { return err } + } else { + c.cryptFLE = opts.Crypt } // OCSP cache @@ -669,9 +687,9 @@ func (c *Client) configure(opts *options.ClientOptions) error { // Deployment if opts.Deployment != nil { - // topology options: WithSeedlist and WithURI + // topology options: WithSeedlist, WithURI, WithSRVServiceName and WithSRVMaxHosts // server options: WithClock and WithConnectionOptions - if len(serverOpts) > 2 || len(topologyOpts) > 2 { + if len(serverOpts) > 2 || len(topologyOpts) > 4 { return errors.New("cannot specify topology or server options with a deployment") } c.deployment = opts.Deployment @@ -779,11 +797,13 @@ func (c *Client) configureCryptFLE(opts *options.AutoEncryptionOptions) error { if !bypass { cir = collInfoRetriever{client: c.metadataClientFLE} } + cryptOpts := &driver.CryptOptions{ CollInfoFn: cir.cryptCollInfo, KeyFn: kr.cryptKeys, MarkFn: c.mongocryptdFLE.markCommand, KmsProviders: kmsProviders, + TLSConfig: opts.TLSConfig, BypassAutoEncryption: bypass, SchemaMap: cryptSchemaMap, } @@ -834,6 +854,9 @@ func (c *Client) ListDatabases(ctx context.Context, filter interface{}, opts ... sess := sessionFromContext(ctx) err := c.validSession(sess) + if err != nil { + return ListDatabasesResult{}, err + } if sess == nil && c.sessionPool != nil { sess, err = session.NewClientSession(c.sessionPool, c.id, session.Implicit) if err != nil { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client_encryption.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client_encryption.go index 4b1f12d3..fe4646b6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/client_encryption.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/client_encryption.go @@ -22,7 +22,7 @@ import ( // ClientEncryption is used to create data keys and explicitly encrypt and decrypt BSON values. type ClientEncryption struct { - crypt *driver.Crypt + crypt driver.Crypt keyVaultClient *Client keyVaultColl *Collection } @@ -54,6 +54,7 @@ func NewClientEncryption(keyVaultClient *Client, opts ...*options.ClientEncrypti KeyFn: kr.cryptKeys, CollInfoFn: cir.cryptCollInfo, KmsProviders: kmsProviders, + TLSConfig: ceo.TLSConfig, }) if err != nil { return nil, err diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go index 02e197d5..a5aaa35e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/collection.go @@ -772,9 +772,9 @@ func aggregate(a aggregateParams) (*Cursor, error) { sess = nil } - selector := makePinnedSelector(sess, a.writeSelector) - if !hasOutputStage { - selector = makeReadPrefSelector(sess, a.readSelector, a.client.localThreshold) + selector := makeReadPrefSelector(sess, a.readSelector, a.client.localThreshold) + if hasOutputStage { + selector = makeOutputAggregateSelector(sess, a.readPreference, a.client.localThreshold) } ao := options.MergeAggregateOptions(a.opts...) @@ -784,6 +784,7 @@ func aggregate(a aggregateParams) (*Cursor, error) { Session(sess). WriteConcern(wc). ReadConcern(rc). + ReadPreference(a.readPreference). CommandMonitor(a.client.monitor). ServerSelector(selector). ClusterClock(a.client.clock). @@ -791,13 +792,8 @@ func aggregate(a aggregateParams) (*Cursor, error) { Collection(a.col). Deployment(a.client.deployment). Crypt(a.client.cryptFLE). - ServerAPI(a.client.serverAPI) - if !hasOutputStage { - // Only pass the user-specified read preference if the aggregation doesn't have a $out or $merge stage. - // Otherwise, the read preference could be forwarded to a mongos, which would error if the aggregation were - // executed against a non-primary node. - op.ReadPreference(a.readPreference) - } + ServerAPI(a.client.serverAPI). + HasOutputStage(hasOutputStage) if ao.AllowDiskUse != nil { op.AllowDiskUse(*ao.AllowDiskUse) @@ -1049,7 +1045,7 @@ func (coll *Collection) Distinct(ctx context.Context, fieldName string, filter i selector := makeReadPrefSelector(sess, coll.readSelector, coll.client.localThreshold) option := options.MergeDistinctOptions(opts...) - op := operation.NewDistinct(fieldName, bsoncore.Document(f)). + op := operation.NewDistinct(fieldName, f). Session(sess).ClusterClock(coll.client.clock). Database(coll.db.name).Collection(coll.name).CommandMonitor(coll.client.monitor). Deployment(coll.client.deployment).ReadConcern(rc).ReadPreference(coll.readPreference). @@ -1278,9 +1274,9 @@ func (coll *Collection) FindOne(ctx context.Context, filter interface{}, ctx = context.Background() } - findOpts := make([]*options.FindOptions, len(opts)) - for i, opt := range opts { - findOpts[i] = &options.FindOptions{ + findOpts := make([]*options.FindOptions, 0, len(opts)) + for _, opt := range opts { + findOpts = append(findOpts, &options.FindOptions{ AllowPartialResults: opt.AllowPartialResults, BatchSize: opt.BatchSize, Collation: opt.Collation, @@ -1299,7 +1295,7 @@ func (coll *Collection) FindOne(ctx context.Context, filter interface{}, Skip: opt.Skip, Snapshot: opt.Snapshot, Sort: opt.Sort, - } + }) } // Unconditionally send a limit to make sure only one document is returned and the cursor is not kept open // by the server. @@ -1680,3 +1676,16 @@ func makeReadPrefSelector(sess *session.Client, selector description.ServerSelec return makePinnedSelector(sess, selector) } + +func makeOutputAggregateSelector(sess *session.Client, rp *readpref.ReadPref, localThreshold time.Duration) description.ServerSelectorFunc { + if sess != nil && sess.TransactionRunning() { + // Use current transaction's read preference if available + rp = sess.CurrentRp + } + + selector := description.CompositeSelector([]description.ServerSelector{ + description.OutputAggregateSelector(rp), + description.LatencySelector(localThreshold), + }) + return makePinnedSelector(sess, selector) +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go index 7de7df5e..798de60e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server.go @@ -25,7 +25,7 @@ type SelectedServer struct { Kind TopologyKind } -// Server contains information about a node in a cluster. This is created from isMaster command responses. If the value +// Server contains information about a node in a cluster. This is created from hello command responses. If the value // of the Kind field is LoadBalancer, only the Addr and Kind fields will be set. All other fields will be set to the // zero value of the field's type. type Server struct { @@ -38,6 +38,7 @@ type Server struct { CanonicalAddr address.Address ElectionID primitive.ObjectID HeartbeatInterval time.Duration + HelloOK bool Hosts []string LastError error LastUpdateTime time.Time @@ -47,6 +48,7 @@ type Server struct { MaxMessageSize uint32 Members []address.Address Passives []string + Passive bool Primary address.Address ReadOnly bool ServiceID *primitive.ObjectID // Only set for servers that are deployed behind a load balancer. @@ -59,7 +61,7 @@ type Server struct { WireVersion *VersionRange } -// NewServer creates a new server description from the given isMaster command response. +// NewServer creates a new server description from the given hello command response. func NewServer(addr address.Address, response bson.Raw) Server { desc := Server{Addr: addr, CanonicalAddr: addr, LastUpdateTime: time.Now().UTC()} elements, err := response.Elements() @@ -99,6 +101,12 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = fmt.Errorf("expected 'electionId' to be a objectID but it's a BSON %s", element.Value().Type) return desc } + case "helloOk": + desc.HelloOK, ok = element.Value().BooleanOK() + if !ok { + desc.LastError = fmt.Errorf("expected 'helloOk' to be a boolean but it's a BSON %s", element.Value().Type) + return desc + } case "hidden": hidden, ok = element.Value().BooleanOK() if !ok { @@ -118,10 +126,10 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = fmt.Errorf("expected 'isWritablePrimary' to be a boolean but it's a BSON %s", element.Value().Type) return desc } - case "ismaster": + case internal.LegacyHelloLowercase: isWritablePrimary, ok = element.Value().BooleanOK() if !ok { - desc.LastError = fmt.Errorf("expected 'ismaster' to be a boolean but it's a BSON %s", element.Value().Type) + desc.LastError = fmt.Errorf("expected legacy hello to be a boolean but it's a BSON %s", element.Value().Type) return desc } case "isreplicaset": @@ -215,6 +223,12 @@ func NewServer(addr address.Address, response bson.Raw) Server { desc.LastError = err return desc } + case "passive": + desc.Passive, ok = element.Value().BooleanOK() + if !ok { + desc.LastError = fmt.Errorf("expected 'passive' to be a boolean but it's a BSON %s", element.Value().Type) + return desc + } case "primary": primary, ok := element.Value().StringValueOK() if !ok { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go index f0c728e4..753c45b6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/description/server_selector.go @@ -130,6 +130,16 @@ func WriteSelector() ServerSelector { // ReadPrefSelector selects servers based on the provided read preference. func ReadPrefSelector(rp *readpref.ReadPref) ServerSelector { + return readPrefSelector(rp, false) +} + +// OutputAggregateSelector selects servers based on the provided read preference given that the underlying operation is +// aggregate with an output stage. +func OutputAggregateSelector(rp *readpref.ReadPref) ServerSelector { + return readPrefSelector(rp, true) +} + +func readPrefSelector(rp *readpref.ReadPref, isOutputAggregate bool) ServerSelector { return ServerSelectorFunc(func(t Topology, candidates []Server) ([]Server, error) { if t.Kind == LoadBalanced { // In LoadBalanced mode, there should only be one server in the topology and it must be selected. We check @@ -152,7 +162,7 @@ func ReadPrefSelector(rp *readpref.ReadPref) ServerSelector { case Single: return candidates, nil case ReplicaSetNoPrimary, ReplicaSetWithPrimary: - return selectForReplicaSet(rp, t, candidates) + return selectForReplicaSet(rp, isOutputAggregate, t, candidates) case Sharded: return selectByKind(candidates, Mongos), nil } @@ -170,11 +180,21 @@ func maxStalenessSupported(wireVersion *VersionRange) error { return nil } -func selectForReplicaSet(rp *readpref.ReadPref, t Topology, candidates []Server) ([]Server, error) { +func selectForReplicaSet(rp *readpref.ReadPref, isOutputAggregate bool, t Topology, candidates []Server) ([]Server, error) { if err := verifyMaxStaleness(rp, t); err != nil { return nil, err } + // If underlying operation is an aggregate with an output stage, only apply read preference + // if all candidates are 5.0+. Otherwise, operate under primary read preference. + if isOutputAggregate { + for _, s := range candidates { + if s.WireVersion.Max < 13 { + return selectByKind(candidates, RSPrimary), nil + } + } + } + switch rp.Mode() { case readpref.PrimaryMode: return selectByKind(candidates, RSPrimary), nil diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/doc.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/doc.go index d184a575..669aa14c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/doc.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/doc.go @@ -105,8 +105,8 @@ // // Note: Auto encryption is an enterprise-only feature. // -// The libmongocrypt C library is required when using client-side encryption. libmongocrypt version 1.1.0 or higher is -// required when using driver version 1.5.0 or higher. To install libmongocrypt, follow the instructions for your +// The libmongocrypt C library is required when using client-side encryption. libmongocrypt version 1.3.0 or higher is +// required when using driver version 1.8.0 or higher. To install libmongocrypt, follow the instructions for your // operating system: // // 1. Linux: follow the instructions listed at diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/download_stream.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/download_stream.go index eb9a3560..08c73c70 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/download_stream.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/download_stream.go @@ -58,7 +58,8 @@ type File struct { // ChunkSize is the maximum number of bytes for each chunk in this file. ChunkSize int32 - // UploadDate is the time this file was added to GridFS in UTC. + // UploadDate is the time this file was added to GridFS in UTC. This field is set by the driver and is not configurable. + // The Metadata field can be used to store a custom date. UploadDate time.Time // Name is the name of this file. @@ -266,7 +267,7 @@ func (ds *DownloadStream) fillBuffer(ctx context.Context) error { if ds.expectedChunk == ds.numChunks { // final chunk can be fewer than ds.chunkSize bytes bytesDownloaded := int64(ds.chunkSize) * (int64(ds.expectedChunk) - int64(1)) - bytesRemaining := ds.fileLen - int64(bytesDownloaded) + bytesRemaining := ds.fileLen - bytesDownloaded if int64(bytesLen) != bytesRemaining { return ErrWrongSize diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/upload_stream.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/upload_stream.go index 93ea79aa..783e9657 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/upload_stream.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/gridfs/upload_stream.go @@ -161,7 +161,7 @@ func (us *UploadStream) uploadChunks(ctx context.Context, uploadPartial bool) er numChunks = int(math.Floor(chunks)) } - docs := make([]interface{}, int(numChunks)) + docs := make([]interface{}, numChunks) id, err := convertFileID(us.FileID) if err != nil { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go index 18fc5244..e8e260f1 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/index_view.go @@ -272,7 +272,8 @@ func (iv IndexView) CreateMany(ctx context.Context, models []IndexModel, opts .. err = op.Execute(ctx) if err != nil { - return nil, replaceErrors(err) + _, err = processWriteError(err) + return nil, err } return names, nil diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go index 3ceb7aa9..89eec434 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongo.go @@ -161,21 +161,6 @@ func transformBsoncoreDocument(registry *bsoncodec.Registry, val interface{}, ma return b, nil } -func ensureID(d bsonx.Doc) (bsonx.Doc, interface{}) { - var id interface{} - - elem, err := d.LookupElementErr("_id") - switch err.(type) { - case nil: - id = elem - default: - oid := primitive.NewObjectID() - d = append(d, bsonx.Elem{"_id", bsonx.ObjectID(oid)}) - id = oid - } - return d, id -} - func ensureDollarKey(doc bsoncore.Document) error { firstElem, err := doc.IndexErr(0) if err != nil { @@ -225,20 +210,43 @@ func transformAggregatePipeline(registry *bsoncodec.Registry, pipeline interface return nil, false, fmt.Errorf("can only transform slices and arrays into aggregation pipelines, but got %v", val.Kind()) } - aidx, arr := bsoncore.AppendArrayStart(nil) var hasOutputStage bool valLen := val.Len() + switch t := pipeline.(type) { // Explicitly forbid non-empty pipelines that are semantically single documents // and are implemented as slices. - switch t := pipeline.(type) { case bson.D, bson.Raw, bsoncore.Document: if valLen > 0 { return nil, false, fmt.Errorf("%T is not an allowed pipeline type as it represents a single document. Use bson.A or mongo.Pipeline instead", t) } + // bsoncore.Arrays do not need to be transformed. Only check validity and presence of output stage. + case bsoncore.Array: + if err := t.Validate(); err != nil { + return nil, false, err + } + + values, err := t.Values() + if err != nil { + return nil, false, err + } + + numVals := len(values) + if numVals == 0 { + return bsoncore.Document(t), false, nil + } + + // If not empty, check if first value of the last stage is $out or $merge. + if lastStage, ok := values[numVals-1].DocumentOK(); ok { + if elem, err := lastStage.IndexErr(0); err == nil && (elem.Key() == "$out" || elem.Key() == "$merge") { + hasOutputStage = true + } + } + return bsoncore.Document(t), hasOutputStage, nil } + aidx, arr := bsoncore.AppendArrayStart(nil) for idx := 0; idx < valLen; idx++ { doc, err := transformBsoncoreDocument(registry, val.Index(idx).Interface(), true, fmt.Sprintf("pipeline stage :%v", idx)) if err != nil { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go index dac99746..c36b1d31 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/mongocryptd.go @@ -115,6 +115,8 @@ func (mc *mcryptClient) disconnect(ctx context.Context) error { } func (mc *mcryptClient) spawnProcess() error { + // Ignore gosec warning about subprocess launched with externally-provided path variable. + /* #nosec G204 */ cmd := exec.Command(mc.path, mc.spawnArgs...) cmd.Stdout = nil cmd.Stderr = nil diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/autoencryptionoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/autoencryptionoptions.go index 517b69e6..89c3c05f 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/autoencryptionoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/autoencryptionoptions.go @@ -6,6 +6,10 @@ package options +import ( + "crypto/tls" +) + // AutoEncryptionOptions represents options used to configure auto encryption/decryption behavior for a mongo.Client // instance. // @@ -27,6 +31,7 @@ type AutoEncryptionOptions struct { SchemaMap map[string]interface{} BypassAutoEncryption *bool ExtraOptions map[string]interface{} + TLSConfig map[string]*tls.Config } // AutoEncryption creates a new AutoEncryptionOptions configured with default values. @@ -91,6 +96,23 @@ func (a *AutoEncryptionOptions) SetExtraOptions(extraOpts map[string]interface{} return a } +// SetTLSConfig specifies tls.Config instances for each KMS provider to use to configure TLS on all connections created +// to the KMS provider. +// +// This should only be used to set custom TLS configurations. By default, the connection will use an empty tls.Config{} with MinVersion set to tls.VersionTLS12. +func (a *AutoEncryptionOptions) SetTLSConfig(tlsOpts map[string]*tls.Config) *AutoEncryptionOptions { + tlsConfigs := make(map[string]*tls.Config) + for provider, config := range tlsOpts { + // use TLS min version 1.2 to enforce more secure hash algorithms and advanced cipher suites + if config.MinVersion == 0 { + config.MinVersion = tls.VersionTLS12 + } + tlsConfigs[provider] = config + } + a.TLSConfig = tlsConfigs + return a +} + // MergeAutoEncryptionOptions combines the argued AutoEncryptionOptions in a last-one wins fashion. func MergeAutoEncryptionOptions(opts ...*AutoEncryptionOptions) *AutoEncryptionOptions { aeo := AutoEncryption() @@ -117,6 +139,9 @@ func MergeAutoEncryptionOptions(opts ...*AutoEncryptionOptions) *AutoEncryptionO if opt.ExtraOptions != nil { aeo.ExtraOptions = opt.ExtraOptions } + if opt.TLSConfig != nil { + aeo.TLSConfig = opt.TLSConfig + } } return aeo diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientencryptionoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientencryptionoptions.go index ea770413..b8f6e871 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientencryptionoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientencryptionoptions.go @@ -6,10 +6,16 @@ package options +import ( + "crypto/tls" + "fmt" +) + // ClientEncryptionOptions represents all possible options used to configure a ClientEncryption instance. type ClientEncryptionOptions struct { KeyVaultNamespace string KmsProviders map[string]map[string]interface{} + TLSConfig map[string]*tls.Config } // ClientEncryption creates a new ClientEncryptionOptions instance. @@ -29,6 +35,86 @@ func (c *ClientEncryptionOptions) SetKmsProviders(providers map[string]map[strin return c } +// SetTLSConfig specifies tls.Config instances for each KMS provider to use to configure TLS on all connections created +// to the KMS provider. +// +// This should only be used to set custom TLS configurations. By default, the connection will use an empty tls.Config{} with MinVersion set to tls.VersionTLS12. +func (c *ClientEncryptionOptions) SetTLSConfig(tlsOpts map[string]*tls.Config) *ClientEncryptionOptions { + tlsConfigs := make(map[string]*tls.Config) + for provider, config := range tlsOpts { + // use TLS min version 1.2 to enforce more secure hash algorithms and advanced cipher suites + if config.MinVersion == 0 { + config.MinVersion = tls.VersionTLS12 + } + tlsConfigs[provider] = config + } + c.TLSConfig = tlsConfigs + return c +} + +// BuildTLSConfig specifies tls.Config options for each KMS provider to use to configure TLS on all connections created +// to the KMS provider. The input map should contain a mapping from each KMS provider to a document containing the necessary +// options, as follows: +// +// { +// "kmip": { +// "tlsCertificateKeyFile": "foo.pem", +// "tlsCAFile": "fooCA.pem" +// } +// } +// +// Currently, the following TLS options are supported: +// +// 1. "tlsCertificateKeyFile" (or "sslClientCertificateKeyFile"): The "tlsCertificateKeyFile" option specifies a path to +// the client certificate and private key, which must be concatenated into one file. +// +// 2. "tlsCertificateKeyFilePassword" (or "sslClientCertificateKeyPassword"): Specify the password to decrypt the client +// private key file (e.g. "tlsCertificateKeyFilePassword=password"). +// +// 3. "tlsCaFile" (or "sslCertificateAuthorityFile"): Specify the path to a single or bundle of certificate authorities +// to be considered trusted when making a TLS connection (e.g. "tlsCaFile=/path/to/caFile"). +// +// This should only be used to set custom TLS options. By default, the connection will use an empty tls.Config{} with MinVersion set to tls.VersionTLS12. +func BuildTLSConfig(tlsOpts map[string]interface{}) (*tls.Config, error) { + // use TLS min version 1.2 to enforce more secure hash algorithms and advanced cipher suites + cfg := &tls.Config{MinVersion: tls.VersionTLS12} + + for name := range tlsOpts { + var err error + switch name { + case "tlsCertificateKeyFile", "sslClientCertificateKeyFile": + clientCertPath, ok := tlsOpts[name].(string) + if !ok { + return nil, fmt.Errorf("expected %q value to be of type string, got %T", name, tlsOpts[name]) + } + // apply custom key file password if found, otherwise use empty string + if keyPwd, found := tlsOpts["tlsCertificateKeyFilePassword"].(string); found { + _, err = addClientCertFromConcatenatedFile(cfg, clientCertPath, keyPwd) + } else if keyPwd, found := tlsOpts["sslClientCertificateKeyPassword"].(string); found { + _, err = addClientCertFromConcatenatedFile(cfg, clientCertPath, keyPwd) + } else { + _, err = addClientCertFromConcatenatedFile(cfg, clientCertPath, "") + } + case "tlsCertificateKeyFilePassword", "sslClientCertificateKeyPassword": + continue + case "tlsCAFile", "sslCertificateAuthorityFile": + caPath, ok := tlsOpts[name].(string) + if !ok { + return nil, fmt.Errorf("expected %q value to be of type string, got %T", name, tlsOpts[name]) + } + err = addCACertFromFile(cfg, caPath) + default: + return nil, fmt.Errorf("unrecognized TLS option %v", name) + } + + if err != nil { + return nil, err + } + } + + return cfg, nil +} + // MergeClientEncryptionOptions combines the argued ClientEncryptionOptions in a last-one wins fashion. func MergeClientEncryptionOptions(opts ...*ClientEncryptionOptions) *ClientEncryptionOptions { ceo := ClientEncryption() @@ -43,6 +129,9 @@ func MergeClientEncryptionOptions(opts ...*ClientEncryptionOptions) *ClientEncry if opt.KmsProviders != nil { ceo.KmsProviders = opt.KmsProviders } + if opt.TLSConfig != nil { + ceo.TLSConfig = opt.TLSConfig + } } return ceo diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go index d66114fa..b15d7804 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions.go @@ -109,6 +109,7 @@ type ClientOptions struct { MaxConnIdleTime *time.Duration MaxPoolSize *uint64 MinPoolSize *uint64 + MaxConnecting *uint64 PoolMonitor *event.PoolMonitor Monitor *event.CommandMonitor ServerMonitor *event.ServerMonitor @@ -121,6 +122,8 @@ type ClientOptions struct { ServerAPIOptions *ServerAPIOptions ServerSelectionTimeout *time.Duration SocketTimeout *time.Duration + SRVMaxHosts *int + SRVServiceName *string TLSConfig *tls.Config WriteConcern *writeconcern.WriteConcern ZlibLevel *int @@ -136,6 +139,13 @@ type ClientOptions struct { // release. AuthenticateToAnything *bool + // Crypt specifies a custom driver.Crypt to be used to encrypt and decrypt documents. The default is no + // encryption. + // + // Deprecated: This option is for internal use only and should not be set (see GODRIVER-2149). It may be + // changed or removed in any release. + Crypt driver.Crypt + // Deployment specifies a custom deployment to use for the new Client. // // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any @@ -180,12 +190,25 @@ func (c *ClientOptions) validateAndSetError() { if c.LoadBalanced != nil && *c.LoadBalanced { if len(c.Hosts) > 1 { c.err = internal.ErrLoadBalancedWithMultipleHosts + return } if c.ReplicaSet != nil { c.err = internal.ErrLoadBalancedWithReplicaSet + return } if c.Direct != nil { c.err = internal.ErrLoadBalancedWithDirectConnection + return + } + } + + // Validation for srvMaxHosts. + if c.SRVMaxHosts != nil && *c.SRVMaxHosts > 0 { + if c.ReplicaSet != nil { + c.err = internal.ErrSRVMaxHostsWithReplicaSet + } + if c.LoadBalanced != nil && *c.LoadBalanced { + c.err = internal.ErrSRVMaxHostsWithLoadBalanced } } } @@ -290,6 +313,10 @@ func (c *ClientOptions) ApplyURI(uri string) *ClientOptions { c.MinPoolSize = &cs.MinPoolSize } + if cs.MaxConnectingSet { + c.MaxConnecting = &cs.MaxConnecting + } + if cs.ReadConcernLevel != "" { c.ReadConcern = readconcern.New(readconcern.Level(cs.ReadConcernLevel)) } @@ -338,6 +365,14 @@ func (c *ClientOptions) ApplyURI(uri string) *ClientOptions { c.SocketTimeout = &cs.SocketTimeout } + if cs.SRVMaxHosts != 0 { + c.SRVMaxHosts = &cs.SRVMaxHosts + } + + if cs.SRVServiceName != "" { + c.SRVServiceName = &cs.SRVServiceName + } + if cs.SSL { tlsConfig := new(tls.Config) @@ -553,6 +588,14 @@ func (c *ClientOptions) SetMinPoolSize(u uint64) *ClientOptions { return c } +// SetMaxConnecting specifies the maximum number of connections a connection pool may establish simultaneously. This can +// also be set through the "maxConnecting" URI option (e.g. "maxConnecting=2"). If this is 0, the default is used. The +// default is 2. Values greater than 100 are not recommended. +func (c *ClientOptions) SetMaxConnecting(u uint64) *ClientOptions { + c.MaxConnecting = &u + return c +} + // SetPoolMonitor specifies a PoolMonitor to receive connection pool events. See the event.PoolMonitor documentation // for more information about the structure of the monitor and events that can be received. func (c *ClientOptions) SetPoolMonitor(m *event.PoolMonitor) *ClientOptions { @@ -760,6 +803,22 @@ func (c *ClientOptions) SetServerAPIOptions(opts *ServerAPIOptions) *ClientOptio return c } +// SetSRVMaxHosts specifies the maximum number of SRV results to randomly select during polling. To limit the number +// of hosts selected in SRV discovery, this function must be called before ApplyURI. This can also be set through +// the "srvMaxHosts" URI option. +func (c *ClientOptions) SetSRVMaxHosts(srvMaxHosts int) *ClientOptions { + c.SRVMaxHosts = &srvMaxHosts + return c +} + +// SetSRVServiceName specifies a custom SRV service name to use in SRV polling. To use a custom SRV service name +// in SRV discovery, this function must be called before ApplyURI. This can also be set through the "srvServiceName" +// URI option. +func (c *ClientOptions) SetSRVServiceName(srvName string) *ClientOptions { + c.SRVServiceName = &srvName + return c +} + // MergeClientOptions combines the given *ClientOptions into a single *ClientOptions in a last one wins fashion. // The specified options are merged with the existing options on the client, with the specified options taking // precedence. @@ -789,6 +848,9 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.ConnectTimeout != nil { c.ConnectTimeout = opt.ConnectTimeout } + if opt.Crypt != nil { + c.Crypt = opt.Crypt + } if opt.HeartbeatInterval != nil { c.HeartbeatInterval = opt.HeartbeatInterval } @@ -810,6 +872,9 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.MinPoolSize != nil { c.MinPoolSize = opt.MinPoolSize } + if opt.MaxConnecting != nil { + c.MaxConnecting = opt.MaxConnecting + } if opt.PoolMonitor != nil { c.PoolMonitor = opt.PoolMonitor } @@ -849,6 +914,12 @@ func MergeClientOptions(opts ...*ClientOptions) *ClientOptions { if opt.SocketTimeout != nil { c.SocketTimeout = opt.SocketTimeout } + if opt.SRVMaxHosts != nil { + c.SRVMaxHosts = opt.SRVMaxHosts + } + if opt.SRVServiceName != nil { + c.SRVServiceName = opt.SRVServiceName + } if opt.TLSConfig != nil { c.TLSConfig = opt.TLSConfig } @@ -966,7 +1037,7 @@ func addClientCertFromBytes(cfg *tls.Config, data []byte, keyPasswd string) (str if err != nil { return "", err } - keyBytes, err = x509MarshalPKCS8PrivateKey(decrypted) + keyBytes, err = x509.MarshalPKCS8PrivateKey(decrypted) if err != nil { return "", err } @@ -1002,7 +1073,7 @@ func addClientCertFromBytes(cfg *tls.Config, data []byte, keyPasswd string) (str return "", err } - return x509CertSubject(crt), nil + return crt.Subject.String(), nil } func stringSliceContains(source []string, target string) bool { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_10.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_10.go deleted file mode 100644 index 1943d9c5..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_10.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build go1.10 - -package options - -import "crypto/x509" - -func x509CertSubject(cert *x509.Certificate) string { - return cert.Subject.String() -} - -func x509MarshalPKCS8PrivateKey(pkcs8 interface{}) ([]byte, error) { - return x509.MarshalPKCS8PrivateKey(pkcs8) -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_9.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_9.go deleted file mode 100644 index e1099229..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/clientoptions_1_9.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build !go1.10 - -package options - -import ( - "crypto/x509" - "fmt" -) - -// We don't support Go versions less than 1.10, but Evergreen needs to be able to compile the driver -// using version 1.9 and cert.Subject -func x509CertSubject(cert *x509.Certificate) string { - return "" -} - -// We don't support Go versions less than 1.10, but Evergreen needs to be able to compile the driver -// using version 1.9 and x509.MarshalPKCS8PrivateKey() -func x509MarshalPKCS8PrivateKey(pkcs8 interface{}) ([]byte, error) { - return nil, fmt.Errorf("PKCS8-encrypted client private keys are only supported with go1.10+") -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go index 3fe63c32..130c8e75 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/createcollectionoptions.go @@ -110,10 +110,20 @@ type CreateCollectionOptions struct { // collection. Validator interface{} - // Value indicating after how many seconds old time-series data should be deleted. + // Value indicating after how many seconds old time-series data should be deleted. See + // https://docs.mongodb.com/manual/reference/command/create/ for supported options, and + // https://docs.mongodb.com/manual/core/timeseries-collections/ for more information on time-series + // collections. + // + // This option is only valid for MongoDB versions >= 5.0 ExpireAfterSeconds *int64 - // Options for specifying a time-series collection. + // Options for specifying a time-series collection. See + // https://docs.mongodb.com/manual/reference/command/create/ for supported options, and + // https://docs.mongodb.com/manual/core/timeseries-collections/ for more information on time-series + // collections. + // + // This option is only valid for MongoDB versions >= 5.0 TimeSeriesOptions *TimeSeriesOptions } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/mongooptions.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/mongooptions.go index f6df2437..ff6f6c80 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/mongooptions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/options/mongooptions.go @@ -157,5 +157,3 @@ type MarshalError struct { func (me MarshalError) Error() string { return fmt.Sprintf("cannot transform type %s to a bson.Raw", reflect.TypeOf(me.Value)) } - -var defaultRegistry = bson.DefaultRegistry diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/readpref/options.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/readpref/options.go index f742de0c..68286d10 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/readpref/options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/readpref/options.go @@ -61,7 +61,7 @@ func WithTagSets(tagSets ...tag.Set) Option { // WithHedgeEnabled specifies whether or not hedged reads should be enabled in the server. This feature requires MongoDB // server version 4.4 or higher. For more information about hedged reads, see -// https://docs.mongodb.com/master/core/sharded-cluster-query-router/#mongos-hedged-reads. If not specified, the default +// https://docs.mongodb.com/manual/core/sharded-cluster-query-router/#mongos-hedged-reads. If not specified, the default // is to not send a value to the server, which will result in the server defaults being used. func WithHedgeEnabled(hedgeEnabled bool) Option { return func(rp *ReadPref) error { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/results.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/results.go index 52e2dedd..6951bea6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/results.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/results.go @@ -158,15 +158,30 @@ type IndexSpecification struct { // The index version. Version int32 + + // The length of time, in seconds, for documents to remain in the collection. The default value is 0, which means + // that documents will remain in the collection until they're explicitly deleted or the collection is dropped. + ExpireAfterSeconds *int32 + + // If true, the index will only reference documents that contain the fields specified in the index. The default is + // false. + Sparse *bool + + // If true, the collection will not accept insertion or update of documents where the index key value matches an + // existing value in the index. The default is false. + Unique *bool } var _ bson.Unmarshaler = (*IndexSpecification)(nil) type unmarshalIndexSpecification struct { - Name string `bson:"name"` - Namespace string `bson:"ns"` - KeysDocument bson.Raw `bson:"key"` - Version int32 `bson:"v"` + Name string `bson:"name"` + Namespace string `bson:"ns"` + KeysDocument bson.Raw `bson:"key"` + Version int32 `bson:"v"` + ExpireAfterSeconds *int32 `bson:"expireAfterSeconds"` + Sparse *bool `bson:"sparse"` + Unique *bool `bson:"unique"` } // UnmarshalBSON implements the bson.Unmarshaler interface. @@ -180,6 +195,9 @@ func (i *IndexSpecification) UnmarshalBSON(data []byte) error { i.Namespace = temp.Namespace i.KeysDocument = temp.KeysDocument i.Version = temp.Version + i.ExpireAfterSeconds = temp.ExpireAfterSeconds + i.Sparse = temp.Sparse + i.Unique = temp.Unique return nil } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/mongo/writeconcern/writeconcern.go b/backend/vendor/go.mongodb.org/mongo-driver/mongo/writeconcern/writeconcern.go index b2831bf1..b9145c9e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/mongo/writeconcern/writeconcern.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/mongo/writeconcern/writeconcern.go @@ -105,7 +105,7 @@ func (wc *WriteConcern) MarshalBSONValue() (bsontype.Type, []byte, error) { elems = bsoncore.AppendInt32Element(elems, "w", int32(t)) case string: - elems = bsoncore.AppendStringElement(elems, "w", string(t)) + elems = bsoncore.AppendStringElement(elems, "w", t) } } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/version/version.go b/backend/vendor/go.mongodb.org/mongo-driver/version/version.go index b964a44a..b32487bf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/version/version.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/version/version.go @@ -7,4 +7,4 @@ package version // import "go.mongodb.org/mongo-driver/version" // Driver is the current version of the driver. -var Driver = "v1.7.4" +var Driver = "v1.8.2" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/value.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/value.go index ed95233d..54aa617c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/value.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/bsoncore/value.go @@ -602,7 +602,7 @@ func (v Value) Time() time.Time { if !ok { panic(NewInsufficientBytesError(v.Data, v.Data)) } - return time.Unix(int64(dt)/1000, int64(dt)%1000*1000000) + return time.Unix(dt/1000, dt%1000*1000000) } // TimeOK is the same as Time, except it returns a boolean instead of @@ -615,7 +615,7 @@ func (v Value) TimeOK() (time.Time, bool) { if !ok { return time.Time{}, false } - return time.Unix(int64(dt)/1000, int64(dt)%1000*1000000), true + return time.Unix(dt/1000, dt%1000*1000000), true } // Regex returns the BSON regex value the Value represents. It panics if the value is a BSON diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/document.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/document.go index 6d2c6f31..2d53bc18 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/document.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/document.go @@ -264,7 +264,7 @@ func (d Doc) Equal(id IDoc) bool { } } case MDoc: - unique := make(map[string]struct{}, 0) + unique := make(map[string]struct{}) for _, elem := range d { unique[elem.Key] = struct{}{} val, ok := tt[elem.Key] diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/element.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/element.go index 66054b2c..00d1ba37 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/element.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/element.go @@ -12,8 +12,6 @@ import ( "go.mongodb.org/mongo-driver/bson/bsontype" ) -const validateMaxDepthDefault = 2048 - // ElementTypeError specifies that a method to obtain a BSON value an incorrect type was called on a bson.Value. // // TODO: rename this ValueTypeError. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/mdocument.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/mdocument.go index 380c8629..7877f224 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/mdocument.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/mdocument.go @@ -21,7 +21,7 @@ type MDoc map[string]Val // ReadMDoc will create a Doc using the provided slice of bytes. If the // slice of bytes is not a valid BSON document, this method will return an error. func ReadMDoc(b []byte) (MDoc, error) { - doc := make(MDoc, 0) + doc := make(MDoc) err := doc.UnmarshalBSON(b) if err != nil { return nil, err @@ -188,7 +188,7 @@ func (d MDoc) Equal(id IDoc) bool { } } case Doc: - unique := make(map[string]struct{}, 0) + unique := make(map[string]struct{}) for _, elem := range tt { unique[elem.Key] = struct{}{} val, ok := d[elem.Key] diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/primitive_codecs.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/primitive_codecs.go index 7328a867..01bd1826 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/primitive_codecs.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/primitive_codecs.go @@ -19,7 +19,6 @@ import ( var primitiveCodecs PrimitiveCodecs var tDocument = reflect.TypeOf((Doc)(nil)) -var tMDoc = reflect.TypeOf((MDoc)(nil)) var tArray = reflect.TypeOf((Arr)(nil)) var tValue = reflect.TypeOf(Val{}) var tElementSlice = reflect.TypeOf(([]Elem)(nil)) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/reflectionfree_d_codec.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/reflectionfree_d_codec.go index 9df93ad4..94aa8f33 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/reflectionfree_d_codec.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/reflectionfree_d_codec.go @@ -20,7 +20,6 @@ import ( var ( tPrimitiveD = reflect.TypeOf(primitive.D{}) - tPrimitiveA = reflect.TypeOf(primitive.A{}) tPrimitiveCWS = reflect.TypeOf(primitive.CodeWithScope{}) defaultValueEncoders = bsoncodec.DefaultValueEncoders{} defaultValueDecoders = bsoncodec.DefaultValueDecoders{} @@ -230,7 +229,7 @@ func (r *reflectionFreeDCodec) encodeDocumentValue(ec bsoncodec.EncodeContext, v case int16: return vw.WriteInt32(int32(val)) case int32: - return vw.WriteInt32(int32(val)) + return vw.WriteInt32(val) case int64: return r.encodeInt64(ec, vw, val) case uint: @@ -366,7 +365,7 @@ func (r *reflectionFreeDCodec) encodeInt64(ec bsoncodec.EncodeContext, vw bsonrw if ec.MinSize && fitsIn32Bits(val) { return vw.WriteInt32(int32(val)) } - return vw.WriteInt64(int64(val)) + return vw.WriteInt64(val) } func (r *reflectionFreeDCodec) encodeUint64(ec bsoncodec.EncodeContext, vw bsonrw.ValueWriter, val uint64) error { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/value.go b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/value.go index aa7e9e6b..f66f6b24 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/value.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/bsonx/value.go @@ -30,33 +30,12 @@ type Val struct { primitive interface{} } -func (v Val) reset() Val { - v.primitive = nil // clear out any pointers so we don't accidentally stop them from being garbage collected. - v.t = bsontype.Type(0) - v.bootstrap[0] = 0x00 - v.bootstrap[1] = 0x00 - v.bootstrap[2] = 0x00 - v.bootstrap[3] = 0x00 - v.bootstrap[4] = 0x00 - v.bootstrap[5] = 0x00 - v.bootstrap[6] = 0x00 - v.bootstrap[7] = 0x00 - v.bootstrap[8] = 0x00 - v.bootstrap[9] = 0x00 - v.bootstrap[10] = 0x00 - v.bootstrap[11] = 0x00 - v.bootstrap[12] = 0x00 - v.bootstrap[13] = 0x00 - v.bootstrap[14] = 0x00 - return v -} - func (v Val) string() string { if v.primitive != nil { return v.primitive.(string) } // The string will either end with a null byte or it fills the entire bootstrap space. - length := uint8(v.bootstrap[0]) + length := v.bootstrap[0] return string(v.bootstrap[1 : length+1]) } @@ -190,7 +169,7 @@ func (v Val) MarshalAppendBSONValue(dst []byte) (bsontype.Type, []byte, error) { case bsontype.Boolean: dst = bsoncore.AppendBoolean(dst, v.Boolean()) case bsontype.DateTime: - dst = bsoncore.AppendDateTime(dst, int64(v.DateTime())) + dst = bsoncore.AppendDateTime(dst, v.DateTime()) case bsontype.Null: case bsontype.Regex: pattern, options := v.Regex() @@ -199,9 +178,9 @@ func (v Val) MarshalAppendBSONValue(dst []byte) (bsontype.Type, []byte, error) { ns, ptr := v.DBPointer() dst = bsoncore.AppendDBPointer(dst, ns, ptr) case bsontype.JavaScript: - dst = bsoncore.AppendJavaScript(dst, string(v.JavaScript())) + dst = bsoncore.AppendJavaScript(dst, v.JavaScript()) case bsontype.Symbol: - dst = bsoncore.AppendSymbol(dst, string(v.Symbol())) + dst = bsoncore.AppendSymbol(dst, v.Symbol()) case bsontype.CodeWithScope: code, doc := v.CodeWithScope() var scope []byte @@ -491,16 +470,12 @@ func (v Val) Undefined() { if v.t != bsontype.Undefined { panic(ElementTypeError{"bson.Value.Undefined", v.t}) } - return } // UndefinedOK is the same as Undefined, except it returns a boolean instead of // panicking. func (v Val) UndefinedOK() bool { - if v.t != bsontype.Undefined { - return false - } - return true + return v.t == bsontype.Undefined } // ObjectID returns the BSON ObjectID the Value represents. It panics if the value is a BSON type @@ -568,7 +543,7 @@ func (v Val) Time() time.Time { panic(ElementTypeError{"bson.Value.Time", v.t}) } i := v.i64() - return time.Unix(int64(i)/1000, int64(i)%1000*1000000) + return time.Unix(i/1000, i%1000*1000000) } // TimeOK is the same as Time, except it returns a boolean instead of @@ -578,7 +553,7 @@ func (v Val) TimeOK() (time.Time, bool) { return time.Time{}, false } i := v.i64() - return time.Unix(int64(i)/1000, int64(i)%1000*1000000), true + return time.Unix(i/1000, i%1000*1000000), true } // Null returns the BSON undefined the Value represents. It panics if the value is a BSON type @@ -587,7 +562,6 @@ func (v Val) Null() { if v.t != bsontype.Null && v.t != bsontype.Type(0) { panic(ElementTypeError{"bson.Value.Null", v.t}) } - return } // NullOK is the same as Null, except it returns a boolean instead of @@ -783,16 +757,12 @@ func (v Val) MinKey() { if v.t != bsontype.MinKey { panic(ElementTypeError{"bson.Value.MinKey", v.t}) } - return } // MinKeyOK is the same as MinKey, except it returns a boolean instead of // panicking. func (v Val) MinKeyOK() bool { - if v.t != bsontype.MinKey { - return false - } - return true + return v.t == bsontype.MinKey } // MaxKey returns the BSON maxkey the Value represents. It panics if the value is a BSON type @@ -801,16 +771,12 @@ func (v Val) MaxKey() { if v.t != bsontype.MaxKey { panic(ElementTypeError{"bson.Value.MaxKey", v.t}) } - return } // MaxKeyOK is the same as MaxKey, except it returns a boolean instead of // panicking. func (v Val) MaxKeyOK() bool { - if v.t != bsontype.MaxKey { - return false - } - return true + return v.t == bsontype.MaxKey } // Equal compares v to v2 and returns true if they are equal. Unknown BSON types are diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/DESIGN.md b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/DESIGN.md index 9342cb07..2fde89f8 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/DESIGN.md +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/DESIGN.md @@ -19,5 +19,5 @@ The `Operation` type handles executing a series of commands using a `Deployment` batch split write commands, such as insert. The type itself is heavily documented, so reading the code and comments together should provide an understanding of how the type works. -This type is not meant to be used directly by callers. Instead an wrapping type should be defined -using the IDL and an implementation generated using `operationgen`. +This type is not meant to be used directly by callers. Instead a wrapping type should be defined +using the IDL. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go index d0436904..d45dda61 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/auth.go @@ -13,7 +13,6 @@ import ( "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" - "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver" "go.mongodb.org/mongo-driver/x/mongo/driver/operation" "go.mongodb.org/mongo-driver/x/mongo/driver/session" @@ -80,7 +79,7 @@ func (ah *authHandshaker) GetHandshakeInformation(ctx context.Context, addr addr return ah.wrapped.GetHandshakeInformation(ctx, addr, conn) } - op := operation.NewIsMaster(). + op := operation.NewHello(). AppName(ah.options.AppName). Compressors(ah.options.Compressors). SASLSupportedMechs(ah.options.DBUser). @@ -145,14 +144,14 @@ func (ah *authHandshaker) FinishHandshake(ctx context.Context, conn driver.Conne } func (ah *authHandshaker) authenticate(ctx context.Context, cfg *Config) error { - // If the initial isMaster reply included a response to the speculative authentication attempt, we only need to + // If the initial hello reply included a response to the speculative authentication attempt, we only need to // conduct the remainder of the conversation. if speculativeResponse := ah.handshakeInfo.SpeculativeAuthenticate; speculativeResponse != nil { // Defensively ensure that the server did not include a response if speculative auth was not attempted. if ah.conversation == nil { return errors.New("speculative auth was not attempted but the server included a response") } - return ah.conversation.Finish(ctx, cfg, bsoncore.Document(speculativeResponse)) + return ah.conversation.Finish(ctx, cfg, speculativeResponse) } // If the server does not support speculative authentication or the first attempt was not successful, we need to diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/conversation.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/conversation.go index 2d76e29e..fe8f472c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/conversation.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/conversation.go @@ -16,7 +16,7 @@ import ( // handshake. // // FirstMessage method returns the first message to be sent to the server. This message will be included in the initial -// isMaster command. +// hello command. // // Finish takes the server response to the initial message and conducts the remainder of the conversation to // authenticate the provided connection. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/default.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/default.go index 4da4032f..e266ad54 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/default.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/default.go @@ -36,7 +36,7 @@ type DefaultAuthenticator struct { Cred *Cred // The authenticator to use for speculative authentication. Because the correct auth mechanism is unknown when doing - // the initial isMaster, SCRAM-SHA-256 is used for the speculative attempt. + // the initial hello, SCRAM-SHA-256 is used for the speculative attempt. speculativeAuthenticator SpeculativeAuthenticator } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go index 2649db45..ad820d8e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/rules.go @@ -45,24 +45,24 @@ func (m mapRule) IsValid(value string) bool { return ok } -// whitelist is a generic rule for whitelisting -type whitelist struct { +// allowlist is a generic rule for allowlisting +type allowlist struct { rule } -// IsValid for whitelist checks if the value is within the whitelist -func (w whitelist) IsValid(value string) bool { - return w.rule.IsValid(value) +// IsValid for allowlist checks if the value is within the allowlist +func (a allowlist) IsValid(value string) bool { + return a.rule.IsValid(value) } -// blacklist is a generic rule for blacklisting -type blacklist struct { +// denylist is a generic rule for denylisting +type denylist struct { rule } -// IsValid for whitelist checks if the value is within the whitelist -func (b blacklist) IsValid(value string) bool { - return !b.rule.IsValid(value) +// IsValid for allowlist checks if the value is within the allowlist +func (d denylist) IsValid(value string) bool { + return !d.rule.IsValid(value) } type patterns []string diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go index 1e4662b0..9567a6d6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/internal/awsv4/signer.go @@ -41,7 +41,7 @@ const ( ) var ignoredHeaders = rules{ - blacklist{ + denylist{ mapRule{ authorizationHeader: struct{}{}, "User-Agent": struct{}{}, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbaws.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbaws.go index c485aa12..8b81865e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbaws.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbaws.go @@ -60,7 +60,7 @@ func (a *awsSaslAdapter) Start() (string, []byte, error) { if err != nil { return MongoDBAWS, nil, err } - return MongoDBAWS, []byte(step), nil + return MongoDBAWS, step, nil } func (a *awsSaslAdapter) Next(challenge []byte) ([]byte, error) { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go index d39772ef..6e2c2f4d 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/mongodbcr.go @@ -8,11 +8,14 @@ package auth import ( "context" - "crypto/md5" "fmt" - "io" + // Ignore gosec warning "Blocklisted import crypto/md5: weak cryptographic primitive". We need + // to use MD5 here to implement the MONGODB-CR specification. + /* #nosec G501 */ + "crypto/md5" + "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver" @@ -21,7 +24,8 @@ import ( // MONGODBCR is the mechanism name for MONGODB-CR. // -// The MONGODB-CR authentication mechanism is deprecated in MongoDB 4.0. +// The MONGODB-CR authentication mechanism is deprecated in MongoDB 3.6 and removed in +// MongoDB 4.0. const MONGODBCR = "MONGODB-CR" func newMongoDBCRAuthenticator(cred *Cred) (Authenticator, error) { @@ -34,7 +38,8 @@ func newMongoDBCRAuthenticator(cred *Cred) (Authenticator, error) { // MongoDBCRAuthenticator uses the MONGODB-CR algorithm to authenticate a connection. // -// The MONGODB-CR authentication mechanism is deprecated in MongoDB 4.0. +// The MONGODB-CR authentication mechanism is deprecated in MongoDB 3.6 and removed in +// MongoDB 4.0. type MongoDBCRAuthenticator struct { DB string Username string @@ -43,7 +48,8 @@ type MongoDBCRAuthenticator struct { // Auth authenticates the connection. // -// The MONGODB-CR authentication mechanism is deprecated in MongoDB 4.0. +// The MONGODB-CR authentication mechanism is deprecated in MongoDB 3.6 and removed in +// MongoDB 4.0. func (a *MongoDBCRAuthenticator) Auth(ctx context.Context, cfg *Config) error { db := a.DB @@ -92,6 +98,9 @@ func (a *MongoDBCRAuthenticator) Auth(ctx context.Context, cfg *Config) error { } func (a *MongoDBCRAuthenticator) createKey(nonce string) string { + // Ignore gosec warning "Use of weak cryptographic primitive". We need to use MD5 here to + // implement the MONGODB-CR specification. + /* #nosec G401 */ h := md5.New() _, _ = io.WriteString(h, nonce) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go index b91a08f1..a7ae3368 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/sasl.go @@ -73,7 +73,7 @@ func (sc *saslConversation) FirstMessage() (bsoncore.Document, error) { bsoncore.AppendBinaryElement(nil, "payload", 0x00, payload), } if sc.speculative { - // The "db" field is only appended for speculative auth because the isMaster command is executed against admin + // The "db" field is only appended for speculative auth because the hello command is executed against admin // so this is needed to tell the server the user's auth source. For a non-speculative attempt, the SASL commands // will be executed against the auth source. saslCmdElements = append(saslCmdElements, bsoncore.AppendStringElement(nil, "db", sc.source)) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/util.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/util.go index 36b8c074..a75a006d 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/util.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/auth/util.go @@ -7,14 +7,21 @@ package auth import ( - "crypto/md5" "fmt" "io" + + // Ignore gosec warning "Blocklisted import crypto/md5: weak cryptographic primitive". We need + // to use MD5 here to implement the SCRAM specification. + /* #nosec G501 */ + "crypto/md5" ) const defaultAuthDB = "admin" func mongoPasswordDigest(username, password string) string { + // Ignore gosec warning "Use of weak cryptographic primitive". We need to use MD5 here to + // implement the SCRAM specification. + /* #nosec G401 */ h := md5.New() _, _ = io.WriteString(h, username) _, _ = io.WriteString(h, ":mongo:") diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go index 4c3e4acf..8f521f58 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batch_cursor.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "strings" + "time" "go.mongodb.org/mongo-driver/bson/bsontype" "go.mongodb.org/mongo-driver/event" @@ -31,7 +32,7 @@ type BatchCursor struct { firstBatch bool cmdMonitor *event.CommandMonitor postBatchResumeToken bsoncore.Document - crypt *Crypt + crypt Crypt serverAPI *ServerAPIOptions // legacy server (< 3.2) fields @@ -129,7 +130,7 @@ type CursorOptions struct { MaxTimeMS int64 Limit int32 CommandMonitor *event.CommandMonitor - Crypt *Crypt + Crypt Crypt ServerAPI *ServerAPIOptions } @@ -345,7 +346,7 @@ func (bc *BatchCursor) getMore(ctx context.Context) { return nil } - bc.postBatchResumeToken = bsoncore.Document(pbrtDoc) + bc.postBatchResumeToken = pbrtDoc return nil }, @@ -380,7 +381,6 @@ func (bc *BatchCursor) getMore(ctx context.Context) { bc.err = err } } - return } // PostBatchResumeToken returns the latest seen post batch resume token. @@ -427,6 +427,11 @@ func (lbcd *loadBalancedCursorDeployment) Connection(_ context.Context) (Connect return lbcd.conn, nil } +// MinRTT always returns 0. It implements the driver.Server interface. +func (lbcd *loadBalancedCursorDeployment) MinRTT() time.Duration { + return 0 +} + func (lbcd *loadBalancedCursorDeployment) ProcessError(err error, conn Connection) ProcessErrorResult { return lbcd.errorProcessor.ProcessError(err, conn) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batches.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batches.go index f376b6d3..4c25abd6 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batches.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/batches.go @@ -6,10 +6,6 @@ import ( "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" ) -// this is the amount of reserved buffer space in a message that the -// driver reserves for command overhead. -const reservedCommandBufferBytes = 16 * 10 * 10 * 10 - // ErrDocumentTooLarge occurs when a document that is larger than the maximum size accepted by a // server is passed to an insert command. var ErrDocumentTooLarge = errors.New("an inserted document is too large") diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go index 2e20a055..f5f8631b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/connstring/connstring.go @@ -9,6 +9,7 @@ package connstring // import "go.mongodb.org/mongo-driver/x/mongo/driver/connstr import ( "errors" "fmt" + "math/rand" "net" "net/url" "strconv" @@ -16,11 +17,15 @@ import ( "time" "go.mongodb.org/mongo-driver/internal" + "go.mongodb.org/mongo-driver/internal/randutil" "go.mongodb.org/mongo-driver/mongo/writeconcern" "go.mongodb.org/mongo-driver/x/mongo/driver/dns" "go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage" ) +// random is a package-global pseudo-random number generator. +var random = randutil.NewLockedRand(rand.NewSource(time.Now().UnixNano())) + // ParseAndValidate parses the provided URI into a ConnString object. // It check that all values are valid. func ParseAndValidate(s string) (ConnString, error) { @@ -80,6 +85,8 @@ type ConnString struct { MaxPoolSizeSet bool MinPoolSize uint64 MinPoolSizeSet bool + MaxConnecting uint64 + MaxConnectingSet bool Password string PasswordSet bool ReadConcernLevel string @@ -97,6 +104,8 @@ type ConnString struct { ServerSelectionTimeoutSet bool SocketTimeout time.Duration SocketTimeoutSet bool + SRVMaxHosts int + SRVServiceName string SSL bool SSLSet bool SSLClientCertificateKeyFile string @@ -254,14 +263,25 @@ func (p *parser) parse(original string) error { hosts = uri[:idx] } - var connectionArgsFromTXT []string parsedHosts := strings.Split(hosts, ",") + uri = uri[len(hosts):] + extractedDatabase, err := extractDatabaseFromURI(uri) + if err != nil { + return err + } + uri = extractedDatabase.uri + p.Database = extractedDatabase.db + + // grab connection arguments from URI + connectionArgsFromQueryString, err := extractQueryArgsFromURI(uri) + if err != nil { + return err + } + + // grab connection arguments from TXT record and enable SSL if "mongodb+srv://" + var connectionArgsFromTXT []string if p.Scheme == SchemeMongoDBSRV { - parsedHosts, err = p.dnsResolver.ParseHosts(hosts, true) - if err != nil { - return err - } connectionArgsFromTXT, err = p.dnsResolver.GetConnectionArgsFromTXT(hosts) if err != nil { return err @@ -272,6 +292,32 @@ func (p *parser) parse(original string) error { p.SSLSet = true } + // add connection arguments from URI and TXT records to connstring + connectionArgPairs := append(connectionArgsFromTXT, connectionArgsFromQueryString...) + for _, pair := range connectionArgPairs { + err := p.addOption(pair) + if err != nil { + return err + } + } + + // do SRV lookup if "mongodb+srv://" + if p.Scheme == SchemeMongoDBSRV { + parsedHosts, err = p.dnsResolver.ParseHosts(hosts, p.SRVServiceName, true) + if err != nil { + return err + } + + // If p.SRVMaxHosts is non-zero and is less than the number of hosts, randomly + // select SRVMaxHosts hosts from parsedHosts. + if p.SRVMaxHosts > 0 && p.SRVMaxHosts < len(parsedHosts) { + random.Shuffle(len(parsedHosts), func(i, j int) { + parsedHosts[i], parsedHosts[j] = parsedHosts[j], parsedHosts[i] + }) + parsedHosts = parsedHosts[:p.SRVMaxHosts] + } + } + for _, host := range parsedHosts { err = p.addHost(host) if err != nil { @@ -282,26 +328,6 @@ func (p *parser) parse(original string) error { return fmt.Errorf("must have at least 1 host") } - uri = uri[len(hosts):] - - extractedDatabase, err := extractDatabaseFromURI(uri) - if err != nil { - return err - } - - uri = extractedDatabase.uri - p.Database = extractedDatabase.db - - connectionArgsFromQueryString, err := extractQueryArgsFromURI(uri) - connectionArgPairs := append(connectionArgsFromTXT, connectionArgsFromQueryString...) - - for _, pair := range connectionArgPairs { - err = p.addOption(pair) - if err != nil { - return err - } - } - err = p.setDefaultAuthParams(extractedDatabase.db) if err != nil { return err @@ -355,6 +381,16 @@ func (p *parser) validate() error { } } + // Check for invalid use of SRVMaxHosts. + if p.SRVMaxHosts > 0 { + if p.ReplicaSet != "" { + return internal.ErrSRVMaxHostsWithReplicaSet + } + if p.LoadBalanced { + return internal.ErrSRVMaxHostsWithLoadBalanced + } + } + return nil } @@ -697,6 +733,13 @@ func (p *parser) addOption(pair string) error { } p.MinPoolSize = uint64(n) p.MinPoolSizeSet = true + case "maxconnecting": + n, err := strconv.Atoi(value) + if err != nil || n < 0 { + return fmt.Errorf("invalid value for %s: %s", key, value) + } + p.MaxConnecting = uint64(n) + p.MaxConnectingSet = true case "readconcernlevel": p.ReadConcernLevel = value case "readpreference": @@ -762,6 +805,31 @@ func (p *parser) addOption(pair string) error { } p.SocketTimeout = time.Duration(n) * time.Millisecond p.SocketTimeoutSet = true + case "srvmaxhosts": + // srvMaxHosts can only be set on URIs with the "mongodb+srv" scheme + if p.Scheme != SchemeMongoDBSRV { + return fmt.Errorf("cannot specify srvMaxHosts on non-SRV URI") + } + + n, err := strconv.Atoi(value) + if err != nil || n < 0 { + return fmt.Errorf("invalid value for %s: %s", key, value) + } + p.SRVMaxHosts = n + case "srvservicename": + // srvServiceName can only be set on URIs with the "mongodb+srv" scheme + if p.Scheme != SchemeMongoDBSRV { + return fmt.Errorf("cannot specify srvServiceName on non-SRV URI") + } + + // srvServiceName must be between 1 and 62 characters according to + // our specification. Empty service names are not valid, and the service + // name (including prepended underscore) should not exceed the 63 character + // limit for DNS query subdomains. + if len(value) < 1 || len(value) > 62 { + return fmt.Errorf("srvServiceName value must be between 1 and 62 characters") + } + p.SRVServiceName = value case "ssl", "tls": switch value { case "true": diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/crypt.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/crypt.go index 812db32f..36e0bc4a 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/crypt.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/crypt.go @@ -40,27 +40,52 @@ type CryptOptions struct { MarkFn MarkCommandFn KmsProviders bsoncore.Document SchemaMap map[string]bsoncore.Document + TLSConfig map[string]*tls.Config BypassAutoEncryption bool } -// Crypt consumes the libmongocrypt.MongoCrypt type to iterate the mongocrypt state machine and perform encryption +// Crypt is an interface implemented by types that can encrypt and decrypt instances of +// bsoncore.Document. +// +// Users should rely on the driver's crypt type (used by default) for encryption and decryption +// unless they are perfectly confident in another implementation of Crypt. +type Crypt interface { + // Encrypt encrypts the given command. + Encrypt(ctx context.Context, db string, cmd bsoncore.Document) (bsoncore.Document, error) + // Decrypt decrypts the given command response. + Decrypt(ctx context.Context, cmdResponse bsoncore.Document) (bsoncore.Document, error) + // CreateDataKey creates a data key using the given KMS provider and options. + CreateDataKey(ctx context.Context, kmsProvider string, opts *options.DataKeyOptions) (bsoncore.Document, error) + // EncryptExplicit encrypts the given value with the given options. + EncryptExplicit(ctx context.Context, val bsoncore.Value, opts *options.ExplicitEncryptionOptions) (byte, []byte, error) + // DecryptExplicit decrypts the given encrypted value. + DecryptExplicit(ctx context.Context, subtype byte, data []byte) (bsoncore.Value, error) + // Close cleans up any resources associated with the Crypt instance. + Close() + // BypassAutoEncryption returns true if auto-encryption should be bypassed. + BypassAutoEncryption() bool +} + +// crypt consumes the libmongocrypt.MongoCrypt type to iterate the mongocrypt state machine and perform encryption // and decryption. -type Crypt struct { +type crypt struct { mongoCrypt *mongocrypt.MongoCrypt collInfoFn CollectionInfoFn keyFn KeyRetrieverFn markFn MarkCommandFn + tlsConfig map[string]*tls.Config - BypassAutoEncryption bool + bypassAutoEncryption bool } // NewCrypt creates a new Crypt instance configured with the given AutoEncryptionOptions. -func NewCrypt(opts *CryptOptions) (*Crypt, error) { - c := &Crypt{ +func NewCrypt(opts *CryptOptions) (Crypt, error) { + c := &crypt{ collInfoFn: opts.CollInfoFn, keyFn: opts.KeyFn, markFn: opts.MarkFn, - BypassAutoEncryption: opts.BypassAutoEncryption, + tlsConfig: opts.TLSConfig, + bypassAutoEncryption: opts.BypassAutoEncryption, } mongocryptOpts := options.MongoCrypt().SetKmsProviders(opts.KmsProviders).SetLocalSchemaMap(opts.SchemaMap) @@ -74,8 +99,8 @@ func NewCrypt(opts *CryptOptions) (*Crypt, error) { } // Encrypt encrypts the given command. -func (c *Crypt) Encrypt(ctx context.Context, db string, cmd bsoncore.Document) (bsoncore.Document, error) { - if c.BypassAutoEncryption { +func (c *crypt) Encrypt(ctx context.Context, db string, cmd bsoncore.Document) (bsoncore.Document, error) { + if c.bypassAutoEncryption { return cmd, nil } @@ -89,7 +114,7 @@ func (c *Crypt) Encrypt(ctx context.Context, db string, cmd bsoncore.Document) ( } // Decrypt decrypts the given command response. -func (c *Crypt) Decrypt(ctx context.Context, cmdResponse bsoncore.Document) (bsoncore.Document, error) { +func (c *crypt) Decrypt(ctx context.Context, cmdResponse bsoncore.Document) (bsoncore.Document, error) { cryptCtx, err := c.mongoCrypt.CreateDecryptionContext(cmdResponse) if err != nil { return nil, err @@ -100,7 +125,7 @@ func (c *Crypt) Decrypt(ctx context.Context, cmdResponse bsoncore.Document) (bso } // CreateDataKey creates a data key using the given KMS provider and options. -func (c *Crypt) CreateDataKey(ctx context.Context, kmsProvider string, opts *options.DataKeyOptions) (bsoncore.Document, error) { +func (c *crypt) CreateDataKey(ctx context.Context, kmsProvider string, opts *options.DataKeyOptions) (bsoncore.Document, error) { cryptCtx, err := c.mongoCrypt.CreateDataKeyContext(kmsProvider, opts) if err != nil { return nil, err @@ -111,7 +136,7 @@ func (c *Crypt) CreateDataKey(ctx context.Context, kmsProvider string, opts *opt } // EncryptExplicit encrypts the given value with the given options. -func (c *Crypt) EncryptExplicit(ctx context.Context, val bsoncore.Value, opts *options.ExplicitEncryptionOptions) (byte, []byte, error) { +func (c *crypt) EncryptExplicit(ctx context.Context, val bsoncore.Value, opts *options.ExplicitEncryptionOptions) (byte, []byte, error) { idx, doc := bsoncore.AppendDocumentStart(nil) doc = bsoncore.AppendValueElement(doc, "v", val) doc, _ = bsoncore.AppendDocumentEnd(doc, idx) @@ -132,7 +157,7 @@ func (c *Crypt) EncryptExplicit(ctx context.Context, val bsoncore.Value, opts *o } // DecryptExplicit decrypts the given encrypted value. -func (c *Crypt) DecryptExplicit(ctx context.Context, subtype byte, data []byte) (bsoncore.Value, error) { +func (c *crypt) DecryptExplicit(ctx context.Context, subtype byte, data []byte) (bsoncore.Value, error) { idx, doc := bsoncore.AppendDocumentStart(nil) doc = bsoncore.AppendBinaryElement(doc, "v", subtype, data) doc, _ = bsoncore.AppendDocumentEnd(doc, idx) @@ -152,11 +177,15 @@ func (c *Crypt) DecryptExplicit(ctx context.Context, subtype byte, data []byte) } // Close cleans up any resources associated with the Crypt instance. -func (c *Crypt) Close() { +func (c *crypt) Close() { c.mongoCrypt.Close() } -func (c *Crypt) executeStateMachine(ctx context.Context, cryptCtx *mongocrypt.Context, db string) (bsoncore.Document, error) { +func (c *crypt) BypassAutoEncryption() bool { + return c.bypassAutoEncryption +} + +func (c *crypt) executeStateMachine(ctx context.Context, cryptCtx *mongocrypt.Context, db string) (bsoncore.Document, error) { var err error for { state := cryptCtx.State() @@ -180,7 +209,7 @@ func (c *Crypt) executeStateMachine(ctx context.Context, cryptCtx *mongocrypt.Co } } -func (c *Crypt) collectionInfo(ctx context.Context, cryptCtx *mongocrypt.Context, db string) error { +func (c *crypt) collectionInfo(ctx context.Context, cryptCtx *mongocrypt.Context, db string) error { op, err := cryptCtx.NextOperation() if err != nil { return err @@ -199,7 +228,7 @@ func (c *Crypt) collectionInfo(ctx context.Context, cryptCtx *mongocrypt.Context return cryptCtx.CompleteOperation() } -func (c *Crypt) markCommand(ctx context.Context, cryptCtx *mongocrypt.Context, db string) error { +func (c *crypt) markCommand(ctx context.Context, cryptCtx *mongocrypt.Context, db string) error { op, err := cryptCtx.NextOperation() if err != nil { return err @@ -216,7 +245,7 @@ func (c *Crypt) markCommand(ctx context.Context, cryptCtx *mongocrypt.Context, d return cryptCtx.CompleteOperation() } -func (c *Crypt) retrieveKeys(ctx context.Context, cryptCtx *mongocrypt.Context) error { +func (c *crypt) retrieveKeys(ctx context.Context, cryptCtx *mongocrypt.Context) error { op, err := cryptCtx.NextOperation() if err != nil { return err @@ -236,7 +265,7 @@ func (c *Crypt) retrieveKeys(ctx context.Context, cryptCtx *mongocrypt.Context) return cryptCtx.CompleteOperation() } -func (c *Crypt) decryptKeys(ctx context.Context, cryptCtx *mongocrypt.Context) error { +func (c *crypt) decryptKeys(ctx context.Context, cryptCtx *mongocrypt.Context) error { for { kmsCtx := cryptCtx.NextKmsContext() if kmsCtx == nil { @@ -251,7 +280,7 @@ func (c *Crypt) decryptKeys(ctx context.Context, cryptCtx *mongocrypt.Context) e return cryptCtx.FinishKmsContexts() } -func (c *Crypt) decryptKey(ctx context.Context, kmsCtx *mongocrypt.KmsContext) error { +func (c *crypt) decryptKey(ctx context.Context, kmsCtx *mongocrypt.KmsContext) error { host, err := kmsCtx.HostName() if err != nil { return err @@ -267,7 +296,12 @@ func (c *Crypt) decryptKey(ctx context.Context, kmsCtx *mongocrypt.KmsContext) e addr = fmt.Sprintf("%s:%d", host, defaultKmsPort) } - conn, err := tls.Dial("tcp", addr, &tls.Config{}) + kmsProvider := kmsCtx.KMSProvider() + tlsCfg := c.tlsConfig[kmsProvider] + if tlsCfg == nil { + tlsCfg = &tls.Config{MinVersion: tls.VersionTLS12} + } + conn, err := tls.Dial("tcp", addr, tlsCfg) if err != nil { return err } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go index f71337d1..c48d932a 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/dns/dns.go @@ -24,14 +24,14 @@ type Resolver struct { // DefaultResolver is a Resolver that uses the default Resolver from the net package. var DefaultResolver = &Resolver{net.LookupSRV, net.LookupTXT} -// ParseHosts uses the srv string to get the hosts. -func (r *Resolver) ParseHosts(host string, stopOnErr bool) ([]string, error) { +// ParseHosts uses the srv string and service name to get the hosts. +func (r *Resolver) ParseHosts(host string, srvName string, stopOnErr bool) ([]string, error) { parsedHosts := strings.Split(host, ",") if len(parsedHosts) != 1 { return nil, fmt.Errorf("URI with SRV must include one and only one hostname") } - return r.fetchSeedlistFromSRV(parsedHosts[0], stopOnErr) + return r.fetchSeedlistFromSRV(parsedHosts[0], srvName, stopOnErr) } // GetConnectionArgsFromTXT gets the TXT record associated with the host and returns the connection arguments. @@ -64,7 +64,7 @@ func (r *Resolver) GetConnectionArgsFromTXT(host string) ([]string, error) { return connectionArgsFromTXT, nil } -func (r *Resolver) fetchSeedlistFromSRV(host string, stopOnErr bool) ([]string, error) { +func (r *Resolver) fetchSeedlistFromSRV(host string, srvName string, stopOnErr bool) ([]string, error) { var err error _, _, err = net.SplitHostPort(host) @@ -75,7 +75,11 @@ func (r *Resolver) fetchSeedlistFromSRV(host string, stopOnErr bool) ([]string, return nil, fmt.Errorf("URI with srv must not include a port number") } - _, addresses, err := r.LookupSRV("mongodb", "tcp", host) + // default to "mongodb" as service name if not supplied + if srvName == "" { + srvName = "mongodb" + } + _, addresses, err := r.LookupSRV(srvName, "tcp", host) if err != nil { return nil, err } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go index 6ba7c770..c7637406 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/driver.go @@ -2,6 +2,7 @@ package driver // import "go.mongodb.org/mongo-driver/x/mongo/driver" import ( "context" + "time" "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" @@ -43,6 +44,9 @@ type Subscriber interface { // retrieving and returning of connections. type Server interface { Connection(context.Context) (Connection, error) + + // MinRTT returns the minimum round-trip time to the server observed over the window period. + MinRTT() time.Duration } // Connection represents a connection to a MongoDB server. @@ -52,6 +56,7 @@ type Connection interface { Description() description.Server Close() error ID() string + ServerConnectionID() *int32 Address() address.Address Stale() bool } @@ -137,11 +142,14 @@ type ErrorProcessor interface { } // HandshakeInformation contains information extracted from a MongoDB connection handshake. This is a helper type that -// augments description.Server by also tracking authentication-related fields. We use this type rather than adding -// these fields to description.Server to avoid retaining sensitive information in a user-facing type. +// augments description.Server by also tracking server connection ID and authentication-related fields. We use this type +// rather than adding authentication-related fields to description.Server to avoid retaining sensitive information in a +// user-facing type. The server connection ID is stored in this type because unlike description.Server, all handshakes are +// correlated with a single network connection. type HandshakeInformation struct { Description description.Server SpeculativeAuthenticate bsoncore.Document + ServerConnectionID *int32 SaslSupportedMechs []string } @@ -190,6 +198,11 @@ func (ssd SingleConnectionDeployment) Connection(context.Context) (Connection, e return ssd.C, nil } +// MinRTT always returns 0. It implements the driver.Server interface. +func (ssd SingleConnectionDeployment) MinRTT() time.Duration { + return 0 +} + // TODO(GODRIVER-617): We can likely use 1 type for both the Type and the RetryMode by using // 2 bits for the mode and 1 bit for the type. Although in the practical sense, we might not want to // do that since the type of retryability is tied to the operation itself and isn't going change, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go index 23c94a8b..5deb04eb 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/errors.go @@ -7,6 +7,7 @@ import ( "strings" "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/internal" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" ) @@ -14,7 +15,7 @@ import ( var ( retryableCodes = []int32{11600, 11602, 10107, 13435, 13436, 189, 91, 7, 6, 89, 9001, 262} nodeIsRecoveringCodes = []int32{11600, 11602, 13436, 189, 91} - notMasterCodes = []int32{10107, 13435, 10058} + notPrimaryCodes = []int32{10107, 13435, 10058} nodeIsShuttingDownCodes = []int32{11600, 91} unknownReplWriteConcernCode = int32(79) @@ -73,7 +74,7 @@ func (e ResponseError) Error() string { if e.Wrapped != nil { return fmt.Sprintf("%s: %s", e.Message, e.Wrapped) } - return fmt.Sprintf("%s", e.Message) + return e.Message } // WriteCommandError is an error for a write command. @@ -170,15 +171,15 @@ func (wce WriteConcernError) NodeIsShuttingDown() bool { return hasNoCode && strings.Contains(wce.Message, "node is shutting down") } -// NotMaster returns true if this error is a not master error. -func (wce WriteConcernError) NotMaster() bool { - for _, code := range notMasterCodes { +// NotPrimary returns true if this error is a not primary error. +func (wce WriteConcernError) NotPrimary() bool { + for _, code := range notPrimaryCodes { if wce.Code == int64(code) { return true } } hasNoCode := wce.Code == 0 - return hasNoCode && strings.Contains(wce.Message, "not master") + return hasNoCode && strings.Contains(wce.Message, internal.LegacyNotPrimary) } // WriteError is a non-write concern failure that occurred as a result of a write @@ -316,15 +317,15 @@ func (e Error) NodeIsShuttingDown() bool { return hasNoCode && strings.Contains(e.Message, "node is shutting down") } -// NotMaster returns true if this error is a not master error. -func (e Error) NotMaster() bool { - for _, code := range notMasterCodes { +// NotPrimary returns true if this error is a not primary error. +func (e Error) NotPrimary() bool { + for _, code := range notPrimaryCodes { if e.Code == code { return true } } hasNoCode := e.Code == 0 - return hasNoCode && strings.Contains(e.Message, "not master") + return hasNoCode && strings.Contains(e.Message, internal.LegacyNotPrimary) } // NamespaceNotFound returns true if this errors is a NamespaceNotFound error. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context.go index 77ce8308..69a72d5c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context.go @@ -32,6 +32,12 @@ func (kc *KmsContext) HostName() (string, error) { return C.GoString(hostname), nil } +// KMSProvider gets the KMS provider of the KMS context. +func (kc *KmsContext) KMSProvider() string { + kmsProvider := C.mongocrypt_kms_ctx_get_kms_provider(kc.wrapped, nil) + return C.GoString(kmsProvider) +} + // Message returns the message to send to the KMS. func (kc *KmsContext) Message() ([]byte, error) { msgBinary := newBinary() diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context_not_enabled.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context_not_enabled.go index 8026a190..f2632a86 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context_not_enabled.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/mongocrypt/mongocrypt_kms_context_not_enabled.go @@ -21,6 +21,11 @@ func (kc *KmsContext) Message() ([]byte, error) { panic(cseNotSupportedMsg) } +// KMSProvider gets the KMS provider of the KMS context. +func (kc *KmsContext) KMSProvider() string { + panic(cseNotSupportedMsg) +} + // BytesNeeded returns the number of bytes that should be received from the KMS. // After sending the message to the KMS, this message should be called in a loop until the number returned is 0. func (kc *KmsContext) BytesNeeded() int32 { @@ -31,8 +36,3 @@ func (kc *KmsContext) BytesNeeded() int32 { func (kc *KmsContext) FeedResponse(response []byte) error { panic(cseNotSupportedMsg) } - -// createErrorFromStatus creates a new Error from the status of the KmsContext instance. -func (kc *KmsContext) createErrorFromStatus() error { - panic(cseNotSupportedMsg) -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go index 6a33fca5..56c10c44 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation.go @@ -13,6 +13,7 @@ import ( "go.mongodb.org/mongo-driver/bson/bsontype" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/event" + "go.mongodb.org/mongo-driver/internal" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/mongo/readconcern" "go.mongodb.org/mongo-driver/mongo/readpref" @@ -72,20 +73,22 @@ type startedInformation struct { cmdName string documentSequenceIncluded bool connID string + serverConnID *int32 redacted bool serviceID *primitive.ObjectID } // finishedInformation keeps track of all of the information necessary for monitoring success and failure events. type finishedInformation struct { - cmdName string - requestID int32 - response bsoncore.Document - cmdErr error - connID string - startTime time.Time - redacted bool - serviceID *primitive.ObjectID + cmdName string + requestID int32 + response bsoncore.Document + cmdErr error + connID string + serverConnID *int32 + startTime time.Time + redacted bool + serviceID *primitive.ObjectID } // ResponseInfo contains the context required to parse a server response. @@ -194,18 +197,22 @@ type Operation struct { CommandMonitor *event.CommandMonitor // Crypt specifies a Crypt object to use for automatic client side encryption and decryption. - Crypt *Crypt + Crypt Crypt // ServerAPI specifies options used to configure the API version sent to the server. ServerAPI *ServerAPIOptions + // IsOutputAggregate specifies whether this operation is an aggregate with an output stage. If true, + // read preference will not be added to the command on wire versions < 13. + IsOutputAggregate bool + // cmdName is only set when serializing OP_MSG and is used internally in readWireMessage. cmdName string } // shouldEncrypt returns true if this operation should automatically be encrypted. func (op Operation) shouldEncrypt() bool { - return op.Crypt != nil && !op.Crypt.BypassAutoEncryption + return op.Crypt != nil && !op.Crypt.BypassAutoEncryption() } // selectServer handles performing server selection for an operation. @@ -398,6 +405,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { op.cmdName = startedInfo.cmdName startedInfo.redacted = op.redactCommand(startedInfo.cmdName, startedInfo.cmd) startedInfo.serviceID = conn.Description().ServiceID + startedInfo.serverConnID = conn.ServerConnectionID() op.publishStartedEvent(ctx, startedInfo) // get the moreToCome flag information before we compress @@ -412,23 +420,32 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { } finishedInfo := finishedInformation{ - cmdName: startedInfo.cmdName, - requestID: startedInfo.requestID, - startTime: time.Now(), - connID: startedInfo.connID, - redacted: startedInfo.redacted, - serviceID: startedInfo.serviceID, + cmdName: startedInfo.cmdName, + requestID: startedInfo.requestID, + startTime: time.Now(), + connID: startedInfo.connID, + serverConnID: startedInfo.serverConnID, + redacted: startedInfo.redacted, + serviceID: startedInfo.serviceID, } - // roundtrip using either the full roundTripper or a special one for when the moreToCome - // flag is set - var roundTrip = op.roundTrip - if moreToCome { - roundTrip = op.moreToComeRoundTrip - } - res, err = roundTrip(ctx, conn, wm) - if ep, ok := srvr.(ErrorProcessor); ok { - _ = ep.ProcessError(err, conn) + // Check if there's enough time to perform a best-case network round trip before the Context + // deadline. If not, create a network error that wraps a context.DeadlineExceeded error and + // skip the actual round trip. + if deadline, ok := ctx.Deadline(); ok && time.Now().Add(srvr.MinRTT()).After(deadline) { + err = op.networkError(context.DeadlineExceeded) + } else { + // roundtrip using either the full roundTripper or a special one for when the moreToCome + // flag is set + var roundTrip = op.roundTrip + if moreToCome { + roundTrip = op.moreToComeRoundTrip + } + res, err = roundTrip(ctx, conn, wm) + + if ep, ok := srvr.(ErrorProcessor); ok { + _ = ep.ProcessError(err, conn) + } } finishedInfo.response = res @@ -455,7 +472,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { if retryable && retryableErr && retries != 0 { retries-- - original, err = err, nil + original = err conn.Close() // Avoid leaking the connection. srvr, conn, err = op.getServerAndConnection(ctx) if err != nil || conn == nil || !op.retryable(conn.Description()) { @@ -482,7 +499,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { ConnectionDescription: desc.Server, CurrentIndex: currIndex, } - perr = op.ProcessResponseFn(info) + _ = op.ProcessResponseFn(info) } if batching && len(tt.WriteErrors) > 0 && currIndex > 0 { @@ -493,7 +510,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { // If batching is enabled and either ordered is the default (which is true) or // explicitly set to true and we have write errors, return the errors. - if batching && (op.Batches.Ordered == nil || *op.Batches.Ordered == true) && len(tt.WriteErrors) > 0 { + if batching && (op.Batches.Ordered == nil || *op.Batches.Ordered) && len(tt.WriteErrors) > 0 { return tt } if op.Client != nil && op.Client.Committing && tt.WriteConcernError != nil { @@ -546,7 +563,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { if retryable && retryableErr && retries != 0 { retries-- - original, err = err, nil + original = err conn.Close() // Avoid leaking the connection. srvr, conn, err = op.getServerAndConnection(ctx) if err != nil || conn == nil || !op.retryable(conn.Description()) { @@ -573,7 +590,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { ConnectionDescription: desc.Server, CurrentIndex: currIndex, } - perr = op.ProcessResponseFn(info) + _ = op.ProcessResponseFn(info) } if op.Client != nil && op.Client.Committing && (retryableErr || tt.Code == 50) { @@ -607,7 +624,7 @@ func (op Operation) Execute(ctx context.Context, scratch []byte) error { ConnectionDescription: desc.Server, CurrentIndex: currIndex, } - perr = op.ProcessResponseFn(info) + _ = op.ProcessResponseFn(info) } return err } @@ -664,17 +681,7 @@ func (op Operation) retryable(desc description.Server) bool { func (op Operation) roundTrip(ctx context.Context, conn Connection, wm []byte) ([]byte, error) { err := conn.WriteWireMessage(ctx, wm) if err != nil { - labels := []string{NetworkError} - if op.Client != nil { - op.Client.MarkDirty() - } - if op.Client != nil && op.Client.TransactionRunning() && !op.Client.Committing { - labels = append(labels, TransientTransactionError) - } - if op.Client != nil && op.Client.Committing { - labels = append(labels, UnknownTransactionCommitResult) - } - return nil, Error{Message: err.Error(), Labels: labels, Wrapped: err} + return nil, op.networkError(err) } return op.readWireMessage(ctx, conn, wm) @@ -685,17 +692,7 @@ func (op Operation) readWireMessage(ctx context.Context, conn Connection, wm []b wm, err = conn.ReadWireMessage(ctx, wm[:0]) if err != nil { - labels := []string{NetworkError} - if op.Client != nil { - op.Client.MarkDirty() - } - if op.Client != nil && op.Client.TransactionRunning() && !op.Client.Committing { - labels = append(labels, TransientTransactionError) - } - if op.Client != nil && op.Client.Committing { - labels = append(labels, UnknownTransactionCommitResult) - } - return nil, Error{Message: err.Error(), Labels: labels, Wrapped: err} + return nil, op.networkError(err) } // If we're using a streamable connection, we set its streaming state based on the moreToCome flag in the server @@ -734,6 +731,27 @@ func (op Operation) readWireMessage(ctx context.Context, conn Connection, wm []b return res, nil } +// networkError wraps the provided error in an Error with label "NetworkError" and, if a transaction +// is running or committing, the appropriate transaction state labels. The returned error indicates +// the operation should be retried for reads and writes. If err is nil, networkError returns nil. +func (op Operation) networkError(err error) error { + if err == nil { + return nil + } + + labels := []string{NetworkError} + if op.Client != nil { + op.Client.MarkDirty() + } + if op.Client != nil && op.Client.TransactionRunning() && !op.Client.Committing { + labels = append(labels, TransientTransactionError) + } + if op.Client != nil && op.Client.Committing { + labels = append(labels, UnknownTransactionCommitResult) + } + return Error{Message: err.Error(), Labels: labels, Wrapped: err} +} + // moreToComeRoundTrip writes a wiremessage to the provided connection. This is used when an OP_MSG is // being sent with the moreToCome bit set. func (op *Operation) moreToComeRoundTrip(ctx context.Context, conn Connection, wm []byte) ([]byte, error) { @@ -813,7 +831,7 @@ func (op Operation) addBatchArray(dst []byte) []byte { func (op Operation) createQueryWireMessage(dst []byte, desc description.SelectedServer) ([]byte, startedInformation, error) { var info startedInformation - flags := op.slaveOK(desc) + flags := op.secondaryOK(desc) var wmindex int32 info.requestID = wiremessage.NextRequestID() wmindex, dst = wiremessage.AppendHeaderStart(dst, info.requestID, 0, wiremessage.OpQuery) @@ -826,7 +844,7 @@ func (op Operation) createQueryWireMessage(dst []byte, desc description.Selected dst = wiremessage.AppendQueryNumberToReturn(dst, -1) wrapper := int32(-1) - rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, true) + rp, err := op.createReadPref(desc, true) if err != nil { return dst, info, err } @@ -924,7 +942,7 @@ func (op Operation) createMsgWireMessage(ctx context.Context, dst []byte, desc d dst = op.addServerAPI(dst) dst = bsoncore.AppendStringElement(dst, "$db", op.Database) - rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, false) + rp, err := op.createReadPref(desc, false) if err != nil { return dst, info, err } @@ -1185,9 +1203,17 @@ func (op Operation) getReadPrefBasedOnTransaction() (*readpref.ReadPref, error) return op.ReadPreference, nil } -func (op Operation) createReadPref(serverKind description.ServerKind, topologyKind description.TopologyKind, isOpQuery bool) (bsoncore.Document, error) { - if serverKind == description.Standalone || (isOpQuery && serverKind != description.Mongos) || op.Type == Write { - // Don't send read preference for non-mongos when using OP_QUERY or for all standalones +func (op Operation) createReadPref(desc description.SelectedServer, isOpQuery bool) (bsoncore.Document, error) { + // TODO(GODRIVER-2231): Instead of checking if isOutputAggregate and desc.Server.WireVersion.Max < 13, + // somehow check if supplied readPreference was "overwritten" with primary in description.selectForReplicaSet. + if desc.Server.Kind == description.Standalone || (isOpQuery && desc.Server.Kind != description.Mongos) || + op.Type == Write || (op.IsOutputAggregate && desc.Server.WireVersion.Max < 13) { + // Don't send read preference for: + // 1. all standalones + // 2. non-mongos when using OP_QUERY + // 3. all writes + // 4. when operation is an aggregate with an output stage, and selected server's wire + // version is < 13 return nil, nil } @@ -1198,7 +1224,7 @@ func (op Operation) createReadPref(serverKind description.ServerKind, topologyKi } if rp == nil { - if topologyKind == description.Single && serverKind != description.Mongos { + if desc.Kind == description.Single && desc.Server.Kind != description.Mongos { doc = bsoncore.AppendStringElement(doc, "mode", "primaryPreferred") doc, _ = bsoncore.AppendDocumentEnd(doc, idx) return doc, nil @@ -1208,10 +1234,10 @@ func (op Operation) createReadPref(serverKind description.ServerKind, topologyKi switch rp.Mode() { case readpref.PrimaryMode: - if serverKind == description.Mongos { + if desc.Server.Kind == description.Mongos { return nil, nil } - if topologyKind == description.Single { + if desc.Kind == description.Single { doc = bsoncore.AppendStringElement(doc, "mode", "primaryPreferred") doc, _ = bsoncore.AppendDocumentEnd(doc, idx) return doc, nil @@ -1221,7 +1247,7 @@ func (op Operation) createReadPref(serverKind description.ServerKind, topologyKi doc = bsoncore.AppendStringElement(doc, "mode", "primaryPreferred") case readpref.SecondaryPreferredMode: _, ok := rp.MaxStaleness() - if serverKind == description.Mongos && isOpQuery && !ok && len(rp.TagSets()) == 0 && rp.HedgeEnabled() == nil { + if desc.Server.Kind == description.Mongos && isOpQuery && !ok && len(rp.TagSets()) == 0 && rp.HedgeEnabled() == nil { return nil, nil } doc = bsoncore.AppendStringElement(doc, "mode", "secondaryPreferred") @@ -1267,20 +1293,20 @@ func (op Operation) createReadPref(serverKind description.ServerKind, topologyKi return doc, nil } -func (op Operation) slaveOK(desc description.SelectedServer) wiremessage.QueryFlag { +func (op Operation) secondaryOK(desc description.SelectedServer) wiremessage.QueryFlag { if desc.Kind == description.Single && desc.Server.Kind != description.Mongos { - return wiremessage.SlaveOK + return wiremessage.SecondaryOK } if rp := op.ReadPreference; rp != nil && rp.Mode() != readpref.PrimaryMode { - return wiremessage.SlaveOK + return wiremessage.SecondaryOK } return 0 } func (Operation) canCompress(cmd string) bool { - if cmd == "isMaster" || cmd == "saslStart" || cmd == "saslContinue" || cmd == "getnonce" || cmd == "authenticate" || + if cmd == internal.LegacyHello || cmd == "hello" || cmd == "saslStart" || cmd == "saslContinue" || cmd == "getnonce" || cmd == "authenticate" || cmd == "createUser" || cmd == "updateUser" || cmd == "copydbSaslStart" || cmd == "copydbgetnonce" || cmd == "copydb" { return false } @@ -1436,11 +1462,11 @@ func (op *Operation) redactCommand(cmd string, doc bsoncore.Document) bool { return true } - if strings.ToLower(cmd) != "ismaster" && cmd != "hello" { + if strings.ToLower(cmd) != internal.LegacyHelloLowercase && cmd != "hello" { return false } - // An isMaster without speculative authentication can be monitored. + // A hello without speculative authentication can be monitored. _, err := doc.LookupErr("speculativeAuthenticate") return err == nil } @@ -1467,12 +1493,13 @@ func (op Operation) publishStartedEvent(ctx context.Context, info startedInforma } started := &event.CommandStartedEvent{ - Command: cmdCopy, - DatabaseName: op.Database, - CommandName: info.cmdName, - RequestID: int64(info.requestID), - ConnectionID: info.connID, - ServiceID: info.serviceID, + Command: cmdCopy, + DatabaseName: op.Database, + CommandName: info.cmdName, + RequestID: int64(info.requestID), + ConnectionID: info.connID, + ServerConnectionID: info.serverConnID, + ServiceID: info.serviceID, } op.CommandMonitor.Started(ctx, started) } @@ -1491,15 +1518,16 @@ func (op Operation) publishFinishedEvent(ctx context.Context, info finishedInfor var durationNanos int64 var emptyTime time.Time if info.startTime != emptyTime { - durationNanos = time.Now().Sub(info.startTime).Nanoseconds() + durationNanos = time.Since(info.startTime).Nanoseconds() } finished := event.CommandFinishedEvent{ - CommandName: info.cmdName, - RequestID: int64(info.requestID), - ConnectionID: info.connID, - DurationNanos: durationNanos, - ServiceID: info.serviceID, + CommandName: info.cmdName, + RequestID: int64(info.requestID), + ConnectionID: info.connID, + DurationNanos: durationNanos, + ServerConnectionID: info.serverConnID, + ServiceID: info.serviceID, } if success { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go index b1957a3e..e8cf3b76 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -27,7 +25,7 @@ type AbortTransaction struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -130,7 +128,7 @@ func (at *AbortTransaction) CommandMonitor(monitor *event.CommandMonitor) *Abort } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (at *AbortTransaction) Crypt(crypt *driver.Crypt) *AbortTransaction { +func (at *AbortTransaction) Crypt(crypt driver.Crypt) *AbortTransaction { if at == nil { at = new(AbortTransaction) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.toml deleted file mode 100644 index d4789dd3..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/abort_transaction.toml +++ /dev/null @@ -1,17 +0,0 @@ -version = 0 -name = "AbortTransaction" -documentation = "AbortTransaction performs an abortTransaction operation." - -[properties] -enabled = ["write concern"] -retryable = {mode = "once per command", type = "writes"} - -[command] -name = "abortTransaction" -parameter = "database" - -[request.recoveryToken] -type = "document" -documentation = """ -RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.\ -""" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go index 311d2874..9163fb7c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -44,9 +42,10 @@ type Aggregate struct { retry *driver.RetryMode selector description.ServerSelector writeConcern *writeconcern.WriteConcern - crypt *driver.Crypt + crypt driver.Crypt serverAPI *driver.ServerAPIOptions let bsoncore.Document + hasOutputStage bool result driver.CursorResponse } @@ -104,6 +103,7 @@ func (a *Aggregate) Execute(ctx context.Context) error { Crypt: a.crypt, MinimumWriteConcernWireVersion: 5, ServerAPI: a.serverAPI, + IsOutputAggregate: a.hasOutputStage, }.Execute(ctx, nil) } @@ -352,7 +352,7 @@ func (a *Aggregate) Retry(retry driver.RetryMode) *Aggregate { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (a *Aggregate) Crypt(crypt *driver.Crypt) *Aggregate { +func (a *Aggregate) Crypt(crypt driver.Crypt) *Aggregate { if a == nil { a = new(Aggregate) } @@ -380,3 +380,14 @@ func (a *Aggregate) Let(let bsoncore.Document) *Aggregate { a.let = let return a } + +// HasOutputStage specifies whether the aggregate contains an output stage. Used in determining when to +// append read preference at the operation level. +func (a *Aggregate) HasOutputStage(hos bool) *Aggregate { + if a == nil { + a = new(Aggregate) + } + + a.hasOutputStage = hos + return a +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.toml deleted file mode 100644 index fd397b9c..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/aggregate.toml +++ /dev/null @@ -1,48 +0,0 @@ -version = 0 -name = "Aggregate" -documentation = "Performs an aggregate operation" -response.type = "batch cursor" - -[properties] -enabled = ["read concern", "read preference", "write concern"] -retryable = {mode = "once per command", type = "reads"} -MinimumWriteConcernWireVersion = 5 - -[command] -name = "aggregate" -parameter = "collection" -database = true - -[request.pipeline] -type = "array" -constructor = true -documentation = "Pipeline determines how data is transformed for an aggregation." - -[request.allowDiskUse] -type = "boolean" -documentation = "AllowDiskUse enables writing to temporary files. When true, aggregation stages can write to the dbPath/_tmp directory." - -[request.batchSize] -type = "int32" -documentation = "BatchSize specifies the number of documents to return in every batch." - -[request.bypassDocumentValidation] -type = "boolean" -documentation = "BypassDocumentValidation allows the write to opt-out of document level validation. This only applies when the $out stage is specified." - -[request.collation] -type = "document" -minWireVersionRequired = 5 -documentation = "Collation specifies a collation. This option is only valid for server versions 3.4 and above." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[request.comment] -type = "string" -documentation = "Comment specifies an arbitrary string to help trace the operation through the database profiler, currentOp, and logs." - -[request.hint] -type = "value" -documentation = "Hint specifies the index to use." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go index f2a1ca46..27d02729 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/command.go @@ -1,4 +1,8 @@ -// NOTE: This file is maintained by hand because operationgen cannot generate it. +// Copyright (C) MongoDB, Inc. 2021-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 package operation @@ -28,9 +32,7 @@ type Command struct { monitor *event.CommandMonitor resultResponse bsoncore.Document resultCursor *driver.BatchCursor - srvr driver.Server - desc description.Server - crypt *driver.Crypt + crypt driver.Crypt serverAPI *driver.ServerAPIOptions createCursor bool cursorOpts driver.CursorOptions @@ -185,7 +187,7 @@ func (c *Command) ServerSelector(selector description.ServerSelector) *Command { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (c *Command) Crypt(crypt *driver.Crypt) *Command { +func (c *Command) Crypt(crypt driver.Crypt) *Command { if c == nil { c = new(Command) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go index c5605250..7be5c7cb 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -27,7 +25,7 @@ type CommitTransaction struct { session *session.Client clock *session.ClusterClock monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -133,7 +131,7 @@ func (ct *CommitTransaction) CommandMonitor(monitor *event.CommandMonitor) *Comm } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (ct *CommitTransaction) Crypt(crypt *driver.Crypt) *CommitTransaction { +func (ct *CommitTransaction) Crypt(crypt driver.Crypt) *CommitTransaction { if ct == nil { ct = new(CommitTransaction) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.toml deleted file mode 100644 index c49dbd80..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/commit_transaction.toml +++ /dev/null @@ -1,22 +0,0 @@ -version = 0 -name = "CommitTransaction" -documentation = "CommitTransaction attempts to commit a transaction." - -[properties] -enabled = ["write concern"] -disabled = ["collection"] -retryable = {mode = "once per command", type = "writes"} - -[command] -name = "commitTransaction" -parameter = "database" - -[request.recoveryToken] -type = "document" -documentation = """ -RecoveryToken sets the recovery token to use when committing or aborting a sharded transaction.\ -""" - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go index f38d6aa3..8266fa59 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -30,7 +28,7 @@ type Count struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment readConcern *readconcern.ReadConcern @@ -52,41 +50,38 @@ func buildCountResult(response bsoncore.Document, srvr driver.Server) (CountResu return CountResult{}, err } cr := CountResult{} -elementLoop: for _, element := range elements { switch element.Key() { case "n": // for count using original command var ok bool cr.N, ok = element.Value().AsInt64OK() if !ok { - err = fmt.Errorf("response field 'n' is type int64, but received BSON type %s", + return cr, fmt.Errorf("response field 'n' is type int64, but received BSON type %s", element.Value().Type) - break elementLoop } case "cursor": // for count using aggregate with $collStats firstBatch, err := element.Value().Document().LookupErr("firstBatch") if err != nil { - break elementLoop + return cr, err } // get count value from first batch val := firstBatch.Array().Index(0) count, err := val.Document().LookupErr("n") if err != nil { - break elementLoop + return cr, err } // use count as Int64 for result var ok bool cr.N, ok = count.AsInt64OK() if !ok { - err = fmt.Errorf("response field 'n' is type int64, but received BSON type %s", + return cr, fmt.Errorf("response field 'n' is type int64, but received BSON type %s", element.Value().Type) - break elementLoop } } } - return cr, err + return cr, nil } // NewCount constructs and returns a new Count. @@ -238,7 +233,7 @@ func (c *Count) CommandMonitor(monitor *event.CommandMonitor) *Count { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (c *Count) Crypt(crypt *driver.Crypt) *Count { +func (c *Count) Crypt(crypt driver.Crypt) *Count { if c == nil { c = new(Count) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.toml deleted file mode 100644 index f5d5e032..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/count.toml +++ /dev/null @@ -1,26 +0,0 @@ -version = 0 -name = "Count" -documentation = "Performs a count operation" - -[properties] -enabled = ["read concern", "read preference"] -retryable = {mode = "once per command", type = "reads"} - -[command] -name = "count" -parameter = "collection" - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[request.query] -type = "document" -documentation = "Query determines what results are returned from find." - -[response] -name = "CountResult" - -[response.field.n] -type = "int64" -documentation = "The number of documents found" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go index a06fac7e..9a8b8bfc 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -37,7 +35,7 @@ type Create struct { session *session.Client clock *session.ClusterClock monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -55,8 +53,7 @@ func NewCreate(collectionName string) *Create { } func (c *Create) processResponse(driver.ResponseInfo) error { - var err error - return err + return nil } // Execute runs this operations and returns an error if the operaiton did not execute successfully. @@ -281,7 +278,7 @@ func (c *Create) CommandMonitor(monitor *event.CommandMonitor) *Create { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (c *Create) Crypt(crypt *driver.Crypt) *Create { +func (c *Create) Crypt(crypt driver.Crypt) *Create { if c == nil { c = new(Create) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.toml deleted file mode 100644 index c1e29cfc..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/create.toml +++ /dev/null @@ -1,62 +0,0 @@ -version = 0 -name = "Create" -documentation = "Create a create operation" - -[properties] -enabled = ["write concern"] -disabled = ["collection"] - -[command] -name = "create" -parameter = "collectionName" - -[request.collectionName] -type = "string" -documentation = "Specifies the name of the collection to create." -skip = true -constructor = true - -[request.capped] -type = "boolean" -documentation = "Specifies if the collection is capped." - -[request.collation] -type = "document" -minWireVersionRequired = 5 -documentation = "Collation specifies a collation. This option is only valid for server versions 3.4 and above." - -[request.indexOptionDefaults] -type = "document" -documentation = "Specifies a default configuration for indexes on the collection." - -[request.max] -type = "int64" -documentation = "Specifies the maximum number of documents allowed in a capped collection." - -[request.pipeline] -type = "array" -documentation = "Specifies the agggregtion pipeline to be run against the source to create the view." - -[request.size] -type = "int64" -documentation = "Specifies the maximum size in bytes for a capped collection." - -[request.storageEngine] -type = "document" -documentation = "Specifies the storage engine to use for the index." - -[request.validator] -type = "document" -documentation = "Specifies validation rules for the collection." - -[request.validationAction] -type = "string" -documentation = "Specifies what should happen if a document being inserted does not pass validation." - -[request.validationLevel] -type = "string" -documentation = "Specifies how strictly the server applies validation rules to existing documents in the collection during update operations." - -[request.viewOn] -type = "string" -documentation = "Specifies the name of the source collection or view on which the view will be created." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go index 63d3fc9b..b9ceefe0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -31,7 +29,7 @@ type CreateIndexes struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -61,19 +59,19 @@ func buildCreateIndexesResult(response bsoncore.Document, srvr driver.Server) (C var ok bool cir.CreatedCollectionAutomatically, ok = element.Value().BooleanOK() if !ok { - err = fmt.Errorf("response field 'createdCollectionAutomatically' is type bool, but received BSON type %s", element.Value().Type) + return cir, fmt.Errorf("response field 'createdCollectionAutomatically' is type bool, but received BSON type %s", element.Value().Type) } case "indexesAfter": var ok bool cir.IndexesAfter, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'indexesAfter' is type int32, but received BSON type %s", element.Value().Type) + return cir, fmt.Errorf("response field 'indexesAfter' is type int32, but received BSON type %s", element.Value().Type) } case "indexesBefore": var ok bool cir.IndexesBefore, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'indexesBefore' is type int32, but received BSON type %s", element.Value().Type) + return cir, fmt.Errorf("response field 'indexesBefore' is type int32, but received BSON type %s", element.Value().Type) } } } @@ -208,7 +206,7 @@ func (ci *CreateIndexes) CommandMonitor(monitor *event.CommandMonitor) *CreateIn } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (ci *CreateIndexes) Crypt(crypt *driver.Crypt) *CreateIndexes { +func (ci *CreateIndexes) Crypt(crypt driver.Crypt) *CreateIndexes { if ci == nil { ci = new(CreateIndexes) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.toml deleted file mode 100644 index 43373030..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/createIndexes.toml +++ /dev/null @@ -1,42 +0,0 @@ -version = 0 -name = "CreateIndexes" -documentation = "CreateIndexes performs a createIndexes operation." - -[properties] -enabled = ["write concern"] - -[command] -name = "createIndexes" -parameter = "collection" - -[request.indexes] -type = "array" -constructor = true -documentation = "An array containing index specification documents for the indexes being created." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[request.commitQuorum] -type = "value" -minWireVersionRequired = 9 -documentation = """ -The number of data-bearing members of a replica set, including the primary, that must complete the index builds -successfully before the primary marks the indexes as ready. This should either be a string or int32 value. -""" - -[response] -name = "CreateIndexesResult" - -[response.field.createdCollectionAutomatically] -type = "boolean" -documentation = "If the collection was created automatically." - -[response.field.indexesBefore] -type = "int32" -documentation = "The number of indexes existing before this command." - -[response.field.indexesAfter] -type = "int32" -documentation = "The number of indexes existing after this command." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go index c221f8a3..33976348 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -29,7 +27,7 @@ type Delete struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -57,7 +55,7 @@ func buildDeleteResult(response bsoncore.Document, srvr driver.Server) (DeleteRe var ok bool dr.N, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) + return dr, fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) } } } @@ -190,7 +188,7 @@ func (d *Delete) CommandMonitor(monitor *event.CommandMonitor) *Delete { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (d *Delete) Crypt(crypt *driver.Crypt) *Delete { +func (d *Delete) Crypt(crypt driver.Crypt) *Delete { if d == nil { d = new(Delete) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.toml deleted file mode 100644 index dea0a712..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/delete.toml +++ /dev/null @@ -1,47 +0,0 @@ -version = 0 -name = "Delete" -documentation = "Delete performs a delete operation" - -[properties] -enabled = ["write concern"] -retryable = {mode = "once per command", type = "writes"} -batches = "deletes" - -[command] -name = "delete" -parameter = "collection" - -[request.deletes] -type = "document" -slice = true -constructor = true -variadic = true -required = true -documentation = """ -Deletes adds documents to this operation that will be used to determine what documents to delete when this operation -is executed. These documents should have the form {q: , limit: , collation: }. The -collation field is optional. If limit is 0, there will be no limit on the number of documents deleted.\ -""" - -[request.ordered] -type = "boolean" -documentation = """ -Ordered sets ordered. If true, when a write fails, the operation will return the error, when -false write failures do not stop execution of the operation.\ -""" - -[request.hint] -type = "boolean" -minWireVersionRequired = 5 -documentation = """ -Hint is a flag to indicate that the update document contains a hint. Hint is only supported by -servers >= 4.4. Older servers >= 3.4 will report an error for using the hint option. For servers < -3.4, the driver will return an error if the hint option is used.\ -""" - -[response] -name = "DeleteResult" - -[response.field.n] -type = "int32" -documentation = "Number of documents successfully deleted." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go index a233b9af..0ac804af 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -31,7 +29,7 @@ type Distinct struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment readConcern *readconcern.ReadConcern @@ -205,7 +203,7 @@ func (d *Distinct) CommandMonitor(monitor *event.CommandMonitor) *Distinct { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (d *Distinct) Crypt(crypt *driver.Crypt) *Distinct { +func (d *Distinct) Crypt(crypt driver.Crypt) *Distinct { if d == nil { d = new(Distinct) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.toml deleted file mode 100644 index 81849d56..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/distinct.toml +++ /dev/null @@ -1,37 +0,0 @@ -version = 0 -name = "Distinct" -documentation = "Distinct performs a distinct operation." - -[properties] -enabled = ["read concern", "read preference"] -retryable = {mode = "once per command", type = "reads"} - -[command] -name = "distinct" -parameter = "collection" - -[request.key] -type = "string" -constructor = true -documentation = "Key specifies which field to return distinct values for." - -[request.query] -type = "document" -constructor = true -documentation = "Query specifies which documents to return distinct values from." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[request.collation] -type = "document" -minWireVersionRequired = 5 -documentation = "Collation specifies a collation to be used." - -[response] -name = "DistinctResult" - -[response.field.values] -type = "value" -documentation = "The distinct values for the field." \ No newline at end of file diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go index 769e486e..9f8f8c52 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -27,7 +25,7 @@ type DropCollection struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -55,13 +53,13 @@ func buildDropCollectionResult(response bsoncore.Document, srvr driver.Server) ( var ok bool dcr.NIndexesWas, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'nIndexesWas' is type int32, but received BSON type %s", element.Value().Type) + return dcr, fmt.Errorf("response field 'nIndexesWas' is type int32, but received BSON type %s", element.Value().Type) } case "ns": var ok bool dcr.Ns, ok = element.Value().StringValueOK() if !ok { - err = fmt.Errorf("response field 'ns' is type string, but received BSON type %s", element.Value().Type) + return dcr, fmt.Errorf("response field 'ns' is type string, but received BSON type %s", element.Value().Type) } } } @@ -150,7 +148,7 @@ func (dc *DropCollection) CommandMonitor(monitor *event.CommandMonitor) *DropCol } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (dc *DropCollection) Crypt(crypt *driver.Crypt) *DropCollection { +func (dc *DropCollection) Crypt(crypt driver.Crypt) *DropCollection { if dc == nil { dc = new(DropCollection) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.toml deleted file mode 100644 index b98db33e..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_collection.toml +++ /dev/null @@ -1,21 +0,0 @@ -version = 0 -name = "DropCollection" -documentation = "DropCollection performs a drop operation." - -[command] -name = "drop" -parameter = "collection" - -[properties] -enabled = ["write concern"] - -[response] -name = "DropCollectionResult" - -[response.field.ns] -type = "string" -documentation = "The namespace of the dropped collection." - -[response.field.nIndexesWas] -type = "int32" -documentation = "The number of indexes in the dropped collection." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go index 47bf4f87..f2dc4ed7 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -25,7 +23,7 @@ type DropDatabase struct { session *session.Client clock *session.ClusterClock monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -96,7 +94,7 @@ func (dd *DropDatabase) CommandMonitor(monitor *event.CommandMonitor) *DropDatab } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (dd *DropDatabase) Crypt(crypt *driver.Crypt) *DropDatabase { +func (dd *DropDatabase) Crypt(crypt driver.Crypt) *DropDatabase { if dd == nil { dd = new(DropDatabase) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.toml deleted file mode 100644 index 9c576ea0..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_database.toml +++ /dev/null @@ -1,18 +0,0 @@ -version = 0 -name = "DropDatabase" -documentation = "DropDatabase performs a dropDatabase operation" - -[properties] -enabled = ["write concern"] -disabled = ["collection"] - -[command] -name = "dropDatabase" -parameter = "database" - -[response] -name = "DropDatabaseResult" - -[response.field.dropped] -type = "string" -documentation = "The dropped database." \ No newline at end of file diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go index fa53a0f0..51aedc1c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -29,7 +27,7 @@ type DropIndexes struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -55,7 +53,7 @@ func buildDropIndexesResult(response bsoncore.Document, srvr driver.Server) (Dro var ok bool dir.NIndexesWas, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'nIndexesWas' is type int32, but received BSON type %s", element.Value().Type) + return dir, fmt.Errorf("response field 'nIndexesWas' is type int32, but received BSON type %s", element.Value().Type) } } } @@ -173,7 +171,7 @@ func (di *DropIndexes) CommandMonitor(monitor *event.CommandMonitor) *DropIndexe } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (di *DropIndexes) Crypt(crypt *driver.Crypt) *DropIndexes { +func (di *DropIndexes) Crypt(crypt driver.Crypt) *DropIndexes { if di == nil { di = new(DropIndexes) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.toml deleted file mode 100644 index 8eafe7db..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/drop_indexes.toml +++ /dev/null @@ -1,28 +0,0 @@ -version = 0 -name = "DropIndexes" -documentation = "DropIndexes performs an dropIndexes operation." - -[properties] -enabled = ["write concern"] - -[command] -name = "dropIndexes" -parameter = "collection" - -[request.index] -type = "string" -constructor = true -documentation = """ -Index specifies the name of the index to drop. If '*' is specified, all indexes will be dropped. -""" - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[response] -name = "DropIndexesResult" - -[response.field.nIndexesWas] -type = "int32" -documentation = "Number of indexes that existed before the drop was executed." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go index 94381801..0580c0ad 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -25,7 +23,7 @@ type EndSessions struct { session *session.Client clock *session.ClusterClock monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -113,7 +111,7 @@ func (es *EndSessions) CommandMonitor(monitor *event.CommandMonitor) *EndSession } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (es *EndSessions) Crypt(crypt *driver.Crypt) *EndSessions { +func (es *EndSessions) Crypt(crypt driver.Crypt) *EndSessions { if es == nil { es = new(EndSessions) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.toml deleted file mode 100644 index 92910548..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/end_sessions.toml +++ /dev/null @@ -1,16 +0,0 @@ -version = 0 -name = "EndSessions" -documentation = "EndSessions performs an endSessions operation." - -[properties] -disabled = ["collection"] - -[command] -name = "endSessions" -parameter = "sessionIDs" - -[request.sessionIDs] -type = "array" -documentation = "sessionIDs specify the sessions to be expired." -skip = true -constructor = true diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go index 8e3e0f1c..4d23d494 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -50,7 +48,7 @@ type Find struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment readConcern *readconcern.ReadConcern @@ -444,7 +442,7 @@ func (f *Find) CommandMonitor(monitor *event.CommandMonitor) *Find { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (f *Find) Crypt(crypt *driver.Crypt) *Find { +func (f *Find) Crypt(crypt driver.Crypt) *Find { if f == nil { f = new(Find) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.toml deleted file mode 100644 index dd52fd3d..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find.toml +++ /dev/null @@ -1,105 +0,0 @@ -version = 0 -name = "Find" -documentation = "Find performs a find operation." -response.type = "batch cursor" - -[properties] -enabled = ["collection", "read concern", "read preference", "command monitor", "client session", "cluster clock"] -retryable = {mode = "once per command", type = "reads"} -legacy = "find" - -[command] -name = "find" -parameter = "collection" - -[request.filter] -type = "document" -constructor = true -documentation = "Filter determines what results are returned from find." - -[request.sort] -type = "document" -documentation = "Sort specifies the order in which to return results." - -[request.projection] -type = "document" -documentation = "Project limits the fields returned for all documents." - -[request.hint] -type = "value" -documentation = "Hint specifies the index to use." - -[request.skip] -type = "int64" -documentation = "Skip specifies the number of documents to skip before returning." - -[request.limit] -type = "int64" -documentation = "Limit sets a limit on the number of documents to return." - -[request.batchSize] -type = "int32" -documentation = "BatchSize specifies the number of documents to return in every batch." - -[request.singleBatch] -type = "boolean" -documentation = "SingleBatch specifies whether the results should be returned in a single batch." - -[request.comment] -type = "string" -documentation = "Comment sets a string to help trace an operation." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." - -[request.max] -type = "document" -documentation = "Max sets an exclusive upper bound for a specific index." - -[request.min] -type = "document" -documentation = "Min sets an inclusive lower bound for a specific index." - -[request.returnKey] -type = "boolean" -documentation = "ReturnKey when true returns index keys for all result documents." - -[request.showRecordID] -type = "boolean" -documentation = "ShowRecordID when true adds a $recordId field with the record identifier to returned documents." -keyName = "showRecordId" - -[request.oplogReplay] -type = "boolean" -documentation = "OplogReplay when true replays a replica set's oplog." - -[request.noCursorTimeout] -type = "boolean" -documentation = "NoCursorTimeout when true prevents cursor from timing out after an inactivity period." - -[request.tailable] -type = "boolean" -documentation = "Tailable keeps a cursor open and resumable after the last data has been retrieved." - -[request.awaitData] -type = "boolean" -documentation = "AwaitData when true makes a cursor block before returning when no data is available." - -[request.allowPartialResults] -type = "boolean" -documentation = "AllowPartialResults when true allows partial results to be returned if some shards are down." - -[request.allowDiskUse] -type = "boolean" -minWireVersionRequired = 4 -documentation = "AllowDiskUse when true allows temporary data to be written to disk during the find command." - -[request.collation] -type = "document" -minWireVersionRequired = 5 -documentation = "Collation specifies a collation to be used." - -[request.snapshot] -type = "boolean" -documentation = "Snapshot prevents the cursor from returning a document more than once because of an intervening write operation." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go index d1ad66f0..656d56a8 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -45,7 +43,7 @@ type FindAndModify struct { selector description.ServerSelector writeConcern *writeconcern.WriteConcern retry *driver.RetryMode - crypt *driver.Crypt + crypt driver.Crypt hint bsoncore.Value serverAPI *driver.ServerAPIOptions @@ -74,23 +72,23 @@ func buildFindAndModifyResult(response bsoncore.Document, srvr driver.Server) (F famr := FindAndModifyResult{} for _, element := range elements { switch element.Key() { - case "value": var ok bool famr.Value, ok = element.Value().DocumentOK() - if !ok { - err = fmt.Errorf("response field 'value' is type document, but received BSON type %s", element.Value().Type) + + // The 'value' field returned by a FindAndModify can be null in the case that no document was found. + if element.Value().Type != bsontype.Null && !ok { + return famr, fmt.Errorf("response field 'value' is type document or null, but received BSON type %s", element.Value().Type) } case "lastErrorObject": valDoc, ok := element.Value().DocumentOK() if !ok { - err = fmt.Errorf("response field 'lastErrorObject' is type document, but received BSON type %s", element.Value().Type) - break + return famr, fmt.Errorf("response field 'lastErrorObject' is type document, but received BSON type %s", element.Value().Type) } var leo LastErrorObject if err = bson.Unmarshal(valDoc, &leo); err != nil { - break + return famr, err } famr.LastErrorObject = leo } @@ -410,7 +408,7 @@ func (fam *FindAndModify) Retry(retry driver.RetryMode) *FindAndModify { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (fam *FindAndModify) Crypt(crypt *driver.Crypt) *FindAndModify { +func (fam *FindAndModify) Crypt(crypt driver.Crypt) *FindAndModify { if fam == nil { fam = new(FindAndModify) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.toml deleted file mode 100644 index 4f5edf26..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/find_and_modify.toml +++ /dev/null @@ -1,73 +0,0 @@ -version = 0 -name = "FindAndModify" -documentation = "FindAndModify performs a findAndModify operation." - -[properties] -enabled = ["write concern"] -retryable = {mode = "once", type = "writes"} - -[command] -name = "findAndModify" -parameter = "collection" - -[request.query] -type = "document" -constructor = true -documentation = "Query specifies the selection criteria for the modification." - -[request.sort] -type = "document" -documentation = """ -Sort determines which document the operation modifies if the query matches multiple documents.\ -The first document matched by the sort order will be modified. -""" - -[request.remove] -type = "boolean" -documentation = "Remove specifies that the matched document should be removed. Defaults to false." - -[request.update] -type = "value" -documentation = "Update specifies the update document to perform on the matched document." - -[request.newDocument] -type = "boolean" -documentation = "NewDocument specifies whether to return the modified document or the original. Defaults to false (return original)." - -[request.fields] -type = "document" -documentation = "Fields specifies a subset of fields to return." - -[request.upsert] -type = "boolean" -documentation = "Upsert specifies whether or not to create a new document if no documents match the query when doing an update. Defaults to false." - -[request.bypassDocumentValidation] -type = "boolean" -documentation = "BypassDocumentValidation specifies if document validation can be skipped when executing the operation." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the operation to run." - -[request.collation] -type = "document" -minWireVersionRequired = 5 -documentation = "Collation specifies a collation to be used." - -[request.arrayFilters] -type = "array" -minWireVersionRequired = 6 -documentation = "ArrayFilters specifies an array of filter documents that determines which array elements to modify for an update operation on an array field." - -[request.hint] -type = "value" -minWireVersionRequired = 8 -documentation = "Hint specifies the index to use. This option is only valid for server versions >= 4.4. Server version 4.2 will error if this option is set. For server versions < 4.2, the driver will error if this option is set." - -[response] -name = "FindAndModifyResult" - -[response.field.value] -type = "document" -documentation = "Either the old or modified document, depending on the value of the new parameter." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/hello.go similarity index 50% rename from backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go rename to backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/hello.go index 544ed4e5..d222ada9 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/ismaster.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/hello.go @@ -1,9 +1,14 @@ +// Copyright (C) MongoDB, Inc. 2021-present. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may +// not use this file except in compliance with the License. You may obtain +// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 + package operation import ( "context" "errors" - "fmt" "runtime" "strconv" @@ -17,8 +22,8 @@ import ( "go.mongodb.org/mongo-driver/x/mongo/driver/session" ) -// IsMaster is used to run the isMaster handshake operation. -type IsMaster struct { +// Hello is used to run the handshake operation. +type Hello struct { appname string compressors []string saslSupportedMechs string @@ -33,138 +38,97 @@ type IsMaster struct { res bsoncore.Document } -var _ driver.Handshaker = (*IsMaster)(nil) +var _ driver.Handshaker = (*Hello)(nil) -// NewIsMaster constructs an IsMaster. -func NewIsMaster() *IsMaster { return &IsMaster{} } +// NewHello constructs a Hello. +func NewHello() *Hello { return &Hello{} } // AppName sets the application name in the client metadata sent in this operation. -func (im *IsMaster) AppName(appname string) *IsMaster { - im.appname = appname - return im +func (h *Hello) AppName(appname string) *Hello { + h.appname = appname + return h } // ClusterClock sets the cluster clock for this operation. -func (im *IsMaster) ClusterClock(clock *session.ClusterClock) *IsMaster { - if im == nil { - im = new(IsMaster) +func (h *Hello) ClusterClock(clock *session.ClusterClock) *Hello { + if h == nil { + h = new(Hello) } - im.clock = clock - return im + h.clock = clock + return h } // Compressors sets the compressors that can be used. -func (im *IsMaster) Compressors(compressors []string) *IsMaster { - im.compressors = compressors - return im +func (h *Hello) Compressors(compressors []string) *Hello { + h.compressors = compressors + return h } // SASLSupportedMechs retrieves the supported SASL mechanism for the given user when this operation // is run. -func (im *IsMaster) SASLSupportedMechs(username string) *IsMaster { - im.saslSupportedMechs = username - return im +func (h *Hello) SASLSupportedMechs(username string) *Hello { + h.saslSupportedMechs = username + return h } // Deployment sets the Deployment for this operation. -func (im *IsMaster) Deployment(d driver.Deployment) *IsMaster { - im.d = d - return im +func (h *Hello) Deployment(d driver.Deployment) *Hello { + h.d = d + return h } // SpeculativeAuthenticate sets the document to be used for speculative authentication. -func (im *IsMaster) SpeculativeAuthenticate(doc bsoncore.Document) *IsMaster { - im.speculativeAuth = doc - return im +func (h *Hello) SpeculativeAuthenticate(doc bsoncore.Document) *Hello { + h.speculativeAuth = doc + return h } // TopologyVersion sets the TopologyVersion to be used for heartbeats. -func (im *IsMaster) TopologyVersion(tv *description.TopologyVersion) *IsMaster { - im.topologyVersion = tv - return im +func (h *Hello) TopologyVersion(tv *description.TopologyVersion) *Hello { + h.topologyVersion = tv + return h } -// MaxAwaitTimeMS sets the maximum time for the sever to wait for topology changes during a heartbeat. -func (im *IsMaster) MaxAwaitTimeMS(awaitTime int64) *IsMaster { - im.maxAwaitTimeMS = &awaitTime - return im +// MaxAwaitTimeMS sets the maximum time for the server to wait for topology changes during a heartbeat. +func (h *Hello) MaxAwaitTimeMS(awaitTime int64) *Hello { + h.maxAwaitTimeMS = &awaitTime + return h } // ServerAPI sets the server API version for this operation. -func (im *IsMaster) ServerAPI(serverAPI *driver.ServerAPIOptions) *IsMaster { - im.serverAPI = serverAPI - return im +func (h *Hello) ServerAPI(serverAPI *driver.ServerAPIOptions) *Hello { + h.serverAPI = serverAPI + return h } // LoadBalanced specifies whether or not this operation is being sent over a connection to a load balanced cluster. -func (im *IsMaster) LoadBalanced(lb bool) *IsMaster { - im.loadBalanced = lb - return im +func (h *Hello) LoadBalanced(lb bool) *Hello { + h.loadBalanced = lb + return h } // Result returns the result of executing this operation. -func (im *IsMaster) Result(addr address.Address) description.Server { - return description.NewServer(addr, bson.Raw(im.res)) -} - -func (im *IsMaster) decodeStringSlice(element bsoncore.Element, name string) ([]string, error) { - arr, ok := element.Value().ArrayOK() - if !ok { - return nil, fmt.Errorf("expected '%s' to be an array but it's a BSON %s", name, element.Value().Type) - } - vals, err := arr.Values() - if err != nil { - return nil, err - } - var strs []string - for _, val := range vals { - str, ok := val.StringValueOK() - if !ok { - return nil, fmt.Errorf("expected '%s' to be an array of strings, but found a BSON %s", name, val.Type) - } - strs = append(strs, str) - } - return strs, nil -} - -func (im *IsMaster) decodeStringMap(element bsoncore.Element, name string) (map[string]string, error) { - doc, ok := element.Value().DocumentOK() - if !ok { - return nil, fmt.Errorf("expected '%s' to be a document but it's a BSON %s", name, element.Value().Type) - } - elements, err := doc.Elements() - if err != nil { - return nil, err - } - m := make(map[string]string) - for _, element := range elements { - key := element.Key() - value, ok := element.Value().StringValueOK() - if !ok { - return nil, fmt.Errorf("expected '%s' to be a document of strings, but found a BSON %s", name, element.Value().Type) - } - m[key] = value - } - return m, nil +func (h *Hello) Result(addr address.Address) description.Server { + return description.NewServer(addr, bson.Raw(h.res)) } // handshakeCommand appends all necessary command fields as well as client metadata, SASL supported mechs, and compression. -func (im *IsMaster) handshakeCommand(dst []byte, desc description.SelectedServer) ([]byte, error) { - dst, err := im.command(dst, desc) +func (h *Hello) handshakeCommand(dst []byte, desc description.SelectedServer) ([]byte, error) { + dst, err := h.command(dst, desc) if err != nil { return dst, err } - if im.saslSupportedMechs != "" { - dst = bsoncore.AppendStringElement(dst, "saslSupportedMechs", im.saslSupportedMechs) + if h.saslSupportedMechs != "" { + dst = bsoncore.AppendStringElement(dst, "saslSupportedMechs", h.saslSupportedMechs) } - if im.speculativeAuth != nil { - dst = bsoncore.AppendDocumentElement(dst, "speculativeAuthenticate", im.speculativeAuth) + if h.speculativeAuth != nil { + dst = bsoncore.AppendDocumentElement(dst, "speculativeAuthenticate", h.speculativeAuth) } var idx int32 idx, dst = bsoncore.AppendArrayElementStart(dst, "compression") - for i, compressor := range im.compressors { + for i, compressor := range h.compressors { dst = bsoncore.AppendStringElement(dst, strconv.Itoa(i), compressor) } dst, _ = bsoncore.AppendArrayEnd(dst, idx) @@ -183,9 +147,9 @@ func (im *IsMaster) handshakeCommand(dst []byte, desc description.SelectedServer dst, _ = bsoncore.AppendDocumentEnd(dst, didx) dst = bsoncore.AppendStringElement(dst, "platform", runtime.Version()) - if im.appname != "" { + if h.appname != "" { didx, dst = bsoncore.AppendDocumentElementStart(dst, "application") - dst = bsoncore.AppendStringElement(dst, "name", im.appname) + dst = bsoncore.AppendStringElement(dst, "name", h.appname) dst, _ = bsoncore.AppendDocumentEnd(dst, didx) } dst, _ = bsoncore.AppendDocumentEnd(dst, idx) @@ -194,14 +158,15 @@ func (im *IsMaster) handshakeCommand(dst []byte, desc description.SelectedServer } // command appends all necessary command fields. -func (im *IsMaster) command(dst []byte, _ description.SelectedServer) ([]byte, error) { - if im.serverAPI != nil { +func (h *Hello) command(dst []byte, desc description.SelectedServer) ([]byte, error) { + if h.serverAPI != nil || desc.Server.HelloOK { dst = bsoncore.AppendInt32Element(dst, "hello", 1) } else { - dst = bsoncore.AppendInt32Element(dst, "isMaster", 1) + dst = bsoncore.AppendInt32Element(dst, internal.LegacyHello, 1) } + dst = bsoncore.AppendBooleanElement(dst, "helloOk", true) - if tv := im.topologyVersion; tv != nil { + if tv := h.topologyVersion; tv != nil { var tvIdx int32 tvIdx, dst = bsoncore.AppendDocumentElementStart(dst, "topologyVersion") @@ -209,10 +174,10 @@ func (im *IsMaster) command(dst []byte, _ description.SelectedServer) ([]byte, e dst = bsoncore.AppendInt64Element(dst, "counter", tv.Counter) dst, _ = bsoncore.AppendDocumentEnd(dst, tvIdx) } - if im.maxAwaitTimeMS != nil { - dst = bsoncore.AppendInt64Element(dst, "maxAwaitTimeMS", *im.maxAwaitTimeMS) + if h.maxAwaitTimeMS != nil { + dst = bsoncore.AppendInt64Element(dst, "maxAwaitTimeMS", *h.maxAwaitTimeMS) } - if im.loadBalanced { + if h.loadBalanced { // The loadBalanced parameter should only be added if it's true. We should never explicitly send // loadBalanced=false per the load balancing spec. dst = bsoncore.AppendBooleanElement(dst, "loadBalanced", true) @@ -222,67 +187,70 @@ func (im *IsMaster) command(dst []byte, _ description.SelectedServer) ([]byte, e } // Execute runs this operation. -func (im *IsMaster) Execute(ctx context.Context) error { - if im.d == nil { - return errors.New("an IsMaster must have a Deployment set before Execute can be called") +func (h *Hello) Execute(ctx context.Context) error { + if h.d == nil { + return errors.New("a Hello must have a Deployment set before Execute can be called") } - return im.createOperation().Execute(ctx, nil) + return h.createOperation().Execute(ctx, nil) } -// StreamResponse gets the next streaming isMaster response from the server. -func (im *IsMaster) StreamResponse(ctx context.Context, conn driver.StreamerConnection) error { - return im.createOperation().ExecuteExhaust(ctx, conn, nil) +// StreamResponse gets the next streaming Hello response from the server. +func (h *Hello) StreamResponse(ctx context.Context, conn driver.StreamerConnection) error { + return h.createOperation().ExecuteExhaust(ctx, conn, nil) } -func (im *IsMaster) createOperation() driver.Operation { +func (h *Hello) createOperation() driver.Operation { return driver.Operation{ - Clock: im.clock, - CommandFn: im.command, + Clock: h.clock, + CommandFn: h.command, Database: "admin", - Deployment: im.d, + Deployment: h.d, ProcessResponseFn: func(info driver.ResponseInfo) error { - im.res = info.ServerResponse + h.res = info.ServerResponse return nil }, - ServerAPI: im.serverAPI, + ServerAPI: h.serverAPI, } } // GetHandshakeInformation performs the MongoDB handshake for the provided connection and returns the relevant // information about the server. This function implements the driver.Handshaker interface. -func (im *IsMaster) GetHandshakeInformation(ctx context.Context, _ address.Address, c driver.Connection) (driver.HandshakeInformation, error) { +func (h *Hello) GetHandshakeInformation(ctx context.Context, _ address.Address, c driver.Connection) (driver.HandshakeInformation, error) { err := driver.Operation{ - Clock: im.clock, - CommandFn: im.handshakeCommand, + Clock: h.clock, + CommandFn: h.handshakeCommand, Deployment: driver.SingleConnectionDeployment{c}, Database: "admin", ProcessResponseFn: func(info driver.ResponseInfo) error { - im.res = info.ServerResponse + h.res = info.ServerResponse return nil }, - ServerAPI: im.serverAPI, + ServerAPI: h.serverAPI, }.Execute(ctx, nil) if err != nil { return driver.HandshakeInformation{}, err } info := driver.HandshakeInformation{ - Description: im.Result(c.Address()), + Description: h.Result(c.Address()), } - if speculativeAuthenticate, ok := im.res.Lookup("speculativeAuthenticate").DocumentOK(); ok { + if speculativeAuthenticate, ok := h.res.Lookup("speculativeAuthenticate").DocumentOK(); ok { info.SpeculativeAuthenticate = speculativeAuthenticate } + if serverConnectionID, ok := h.res.Lookup("connectionId").Int32OK(); ok { + info.ServerConnectionID = &serverConnectionID + } // Cast to bson.Raw to lookup saslSupportedMechs to avoid converting from bsoncore.Value to bson.RawValue for the // StringSliceFromRawValue call. - if saslSupportedMechs, lookupErr := bson.Raw(im.res).LookupErr("saslSupportedMechs"); lookupErr == nil { + if saslSupportedMechs, lookupErr := bson.Raw(h.res).LookupErr("saslSupportedMechs"); lookupErr == nil { info.SaslSupportedMechs, err = internal.StringSliceFromRawValue("saslSupportedMechs", saslSupportedMechs) } return info, err } // FinishHandshake implements the Handshaker interface. This is a no-op function because a non-authenticated connection -// does not do anything besides the initial isMaster for a handshake. -func (im *IsMaster) FinishHandshake(context.Context, driver.Connection) error { +// does not do anything besides the initial Hello for a handshake. +func (h *Hello) FinishHandshake(context.Context, driver.Connection) error { return nil } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go index b4d09537..d422ba59 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -30,7 +28,7 @@ type Insert struct { clock *session.ClusterClock collection string monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment selector description.ServerSelector @@ -57,7 +55,7 @@ func buildInsertResult(response bsoncore.Document, srvr driver.Server) (InsertRe var ok bool ir.N, ok = element.Value().AsInt32OK() if !ok { - err = fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) + return ir, fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) } } } @@ -195,7 +193,7 @@ func (i *Insert) CommandMonitor(monitor *event.CommandMonitor) *Insert { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (i *Insert) Crypt(crypt *driver.Crypt) *Insert { +func (i *Insert) Crypt(crypt driver.Crypt) *Insert { if i == nil { i = new(Insert) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.toml deleted file mode 100644 index 24fdd51c..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/insert.toml +++ /dev/null @@ -1,45 +0,0 @@ -version = 0 -name = "Insert" -documentation = "Insert performs an insert operation." - -[properties] -enabled = ["write concern"] -retryable = {mode = "once per command", type = "writes"} -batches = "documents" - -[command] -name = "insert" -parameter = "collection" - -[request.documents] -type = "document" -slice = true -constructor = true -variadic = true -required = true -documentation = """ -Documents adds documents to this operation that will be inserted when this operation is -executed.\ -""" - -[request.ordered] -type = "boolean" -documentation = """ -Ordered sets ordered. If true, when a write fails, the operation will return the error, when -false write failures do not stop execution of the operation.\ -""" - -[request.bypassDocumentValidation] -type = "boolean" -minWireVersion = 4 -documentation = """ -BypassDocumentValidation allows the operation to opt-out of document level validation. Valid -for server versions >= 3.2. For servers < 3.2, this setting is ignored.\ -""" - -[response] -name = "InsertResult" - -[response.field.n] -type = "int32" -documentation = "Number of documents successfully inserted." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go index 067c84ae..d6b31e32 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -35,7 +33,7 @@ type ListDatabases struct { readPreference *readpref.ReadPref retry *driver.RetryMode selector description.ServerSelector - crypt *driver.Crypt + crypt driver.Crypt serverAPI *driver.ServerAPIOptions result ListDatabasesResult @@ -62,76 +60,64 @@ func buildListDatabasesResult(response bsoncore.Document, srvr driver.Server) (L ir := ListDatabasesResult{} for _, element := range elements { switch element.Key() { - case "totalSize": var ok bool ir.TotalSize, ok = element.Value().AsInt64OK() if !ok { - err = fmt.Errorf("response field 'totalSize' is type int64, but received BSON type %s: %s", element.Value().Type, element.Value()) + return ir, fmt.Errorf("response field 'totalSize' is type int64, but received BSON type %s: %s", element.Value().Type, element.Value()) } - case "databases": - // TODO: Make operationgen handle array results. arr, ok := element.Value().ArrayOK() if !ok { - err = fmt.Errorf("response field 'databases' is type array, but received BSON type %s", element.Value().Type) - continue + return ir, fmt.Errorf("response field 'databases' is type array, but received BSON type %s", element.Value().Type) } var tmp bsoncore.Document - marshalErr := bson.Unmarshal(arr, &tmp) - if marshalErr != nil { - err = marshalErr - continue + err := bson.Unmarshal(arr, &tmp) + if err != nil { + return ir, err } - records, marshalErr := tmp.Elements() - if marshalErr != nil { - err = marshalErr - continue + + records, err := tmp.Elements() + if err != nil { + return ir, err } ir.Databases = make([]databaseRecord, len(records)) for i, val := range records { valueDoc, ok := val.Value().DocumentOK() if !ok { - err = fmt.Errorf("'databases' element is type document, but received BSON type %s", val.Value().Type) - continue + return ir, fmt.Errorf("'databases' element is type document, but received BSON type %s", val.Value().Type) } - elems, marshalErr := valueDoc.Elements() - if marshalErr != nil { - err = marshalErr - continue + elems, err := valueDoc.Elements() + if err != nil { + return ir, err } + for _, elem := range elems { switch elem.Key() { - case "name": ir.Databases[i].Name, ok = elem.Value().StringValueOK() if !ok { - err = fmt.Errorf("response field 'name' is type string, but received BSON type %s", elem.Value().Type) - continue + return ir, fmt.Errorf("response field 'name' is type string, but received BSON type %s", elem.Value().Type) } - case "sizeOnDisk": ir.Databases[i].SizeOnDisk, ok = elem.Value().AsInt64OK() if !ok { - err = fmt.Errorf("response field 'sizeOnDisk' is type int64, but received BSON type %s", elem.Value().Type) - continue + return ir, fmt.Errorf("response field 'sizeOnDisk' is type int64, but received BSON type %s", elem.Value().Type) } - case "empty": ir.Databases[i].Empty, ok = elem.Value().BooleanOK() if !ok { - err = fmt.Errorf("response field 'empty' is type bool, but received BSON type %s", elem.Value().Type) - continue + return ir, fmt.Errorf("response field 'empty' is type bool, but received BSON type %s", elem.Value().Type) } } } } } } - return ir, err + return ir, nil } // NewListDatabases constructs and returns a new ListDatabases. @@ -307,7 +293,7 @@ func (ld *ListDatabases) Retry(retry driver.RetryMode) *ListDatabases { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (ld *ListDatabases) Crypt(crypt *driver.Crypt) *ListDatabases { +func (ld *ListDatabases) Crypt(crypt driver.Crypt) *ListDatabases { if ld == nil { ld = new(ListDatabases) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.toml deleted file mode 100644 index 29d5a021..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/listDatabases.toml +++ /dev/null @@ -1,37 +0,0 @@ -version = 0 -name = "ListDatabases" -documentation = "ListDatabases performs a listDatabases operation." - -[properties] -enabled = ["read preference"] -retryable = {mode = "once per command", type = "reads"} -disabled = ["collection"] - -[command] -name = "listDatabases" -parameter = "database" - -[request.filter] -type = "document" -constructor = true -documentation = "Filter determines what results are returned from listDatabases." - - -[request.nameOnly] -type = "boolean" -documentation = "NameOnly specifies whether to only return database names." - -[request.authorizedDatabases] -type = "boolean" -documentation = "AuthorizedDatabases specifies whether to only return databases which the user is authorized to use." - -[response] -name = "ListDatabasesResult" - -[response.field.totalSize] -type = "int64" -documentation = "The sum of the size of all the database files on disk in bytes." - -[response.field.databases] -type = "value" -documentation = "An array of documents, one document for each database" diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go index 8f96eb13..6c98a670 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -27,7 +25,7 @@ type ListCollections struct { session *session.Client clock *session.ClusterClock monitor *event.CommandMonitor - crypt *driver.Crypt + crypt driver.Crypt database string deployment driver.Deployment readPreference *readpref.ReadPref @@ -159,7 +157,7 @@ func (lc *ListCollections) CommandMonitor(monitor *event.CommandMonitor) *ListCo } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (lc *ListCollections) Crypt(crypt *driver.Crypt) *ListCollections { +func (lc *ListCollections) Crypt(crypt driver.Crypt) *ListCollections { if lc == nil { lc = new(ListCollections) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.toml deleted file mode 100644 index 383dae11..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_collections.toml +++ /dev/null @@ -1,23 +0,0 @@ -version = 0 -name = "ListCollections" -documentation = "ListCollections performs a listCollections operation." -response.type = "list collections batch cursor" - -[properties] -enabled = ["read preference"] -disabled = ["collection"] -retryable = {mode = "once per command", type = "reads"} -legacy = "listCollections" - -[command] -name = "listCollections" -parameter = "database" - -[request.filter] -type = "document" -constructor = true -documentation = "Filter determines what results are returned from listCollections." - -[request.nameOnly] -type = "boolean" -documentation = "NameOnly specifies whether to only return collection names." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go index 33db54e4..99bc45b2 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// Code generated by operationgen. DO NOT EDIT. - package operation import ( @@ -31,7 +29,7 @@ type ListIndexes struct { deployment driver.Deployment selector description.ServerSelector retry *driver.RetryMode - crypt *driver.Crypt + crypt driver.Crypt serverAPI *driver.ServerAPIOptions result driver.CursorResponse @@ -205,7 +203,7 @@ func (li *ListIndexes) Retry(retry driver.RetryMode) *ListIndexes { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (li *ListIndexes) Crypt(crypt *driver.Crypt) *ListIndexes { +func (li *ListIndexes) Crypt(crypt driver.Crypt) *ListIndexes { if li == nil { li = new(ListIndexes) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.toml deleted file mode 100644 index 98d0f886..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/list_indexes.toml +++ /dev/null @@ -1,20 +0,0 @@ -version = 0 -name = "ListIndexes" -documentation = "ListIndexes performs a listIndexes operation." -response.type = "batch cursor" - -[properties] -legacy = "listIndexes" -retryable = {mode = "once per command", type = "reads"} - -[command] -name = "listIndexes" -parameter = "collection" - -[request.batchSize] -type = "int32" -documentation = "BatchSize specifies the number of documents to return in every batch." - -[request.maxTimeMS] -type = "int64" -documentation = "MaxTimeMS specifies the maximum amount of time to allow the query to run." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/operation.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/operation.go deleted file mode 100644 index 3a13b504..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/operation.go +++ /dev/null @@ -1,15 +0,0 @@ -package operation - -//go:generate operationgen insert.toml operation insert.go -//go:generate operationgen find.toml operation find.go -//go:generate operationgen list_collections.toml operation list_collections.go -//go:generate operationgen createIndexes.toml operation createIndexes.go -//go:generate operationgen drop_collection.toml operation drop_collection.go -//go:generate operationgen distinct.toml operation distinct.go -//go:generate operationgen drop_indexes.toml operation drop_indexes.go -//go:generate operationgen drop_database.toml operation drop_database.go -//go:generate operationgen commit_transaction.toml operation commit_transaction.go -//go:generate operationgen abort_transaction.toml operation abort_transaction.go -//go:generate operationgen count.toml operation count.go -//go:generate operationgen end_sessions.toml operation end_sessions.go -//go:generate operationgen create.toml operation create.go diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go index 0a3a9e6d..3f22fc06 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.go @@ -4,8 +4,6 @@ // not use this file except in compliance with the License. You may obtain // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -// NOTE: This file is maintained by hand because operationgen cannot generate it. - package operation import ( @@ -39,7 +37,7 @@ type Update struct { writeConcern *writeconcern.WriteConcern retry *driver.RetryMode result UpdateResult - crypt *driver.Crypt + crypt driver.Crypt serverAPI *driver.ServerAPIOptions } @@ -67,26 +65,22 @@ func buildUpdateResult(response bsoncore.Document, srvr driver.Server) (UpdateRe ur := UpdateResult{} for _, element := range elements { switch element.Key() { - case "nModified": var ok bool ur.NModified, ok = element.Value().Int32OK() if !ok { - err = fmt.Errorf("response field 'nModified' is type int32, but received BSON type %s", element.Value().Type) + return ur, fmt.Errorf("response field 'nModified' is type int32, but received BSON type %s", element.Value().Type) } - case "n": var ok bool ur.N, ok = element.Value().Int32OK() if !ok { - err = fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) + return ur, fmt.Errorf("response field 'n' is type int32, but received BSON type %s", element.Value().Type) } - case "upserted": arr, ok := element.Value().ArrayOK() if !ok { - err = fmt.Errorf("response field 'upserted' is type array, but received BSON type %s", element.Value().Type) - break + return ur, fmt.Errorf("response field 'upserted' is type array, but received BSON type %s", element.Value().Type) } var values []bsoncore.Value @@ -98,12 +92,11 @@ func buildUpdateResult(response bsoncore.Document, srvr driver.Server) (UpdateRe for _, val := range values { valDoc, ok := val.DocumentOK() if !ok { - err = fmt.Errorf("upserted value is type document, but received BSON type %s", val.Type) - break + return ur, fmt.Errorf("upserted value is type document, but received BSON type %s", val.Type) } var upsert Upsert if err = bson.Unmarshal(valDoc, &upsert); err != nil { - break + return ur, err } ur.Upserted = append(ur.Upserted, upsert) } @@ -346,7 +339,7 @@ func (u *Update) Retry(retry driver.RetryMode) *Update { } // Crypt sets the Crypt object to use for automatic encryption and decryption. -func (u *Update) Crypt(crypt *driver.Crypt) *Update { +func (u *Update) Crypt(crypt driver.Crypt) *Update { if u == nil { u = new(Update) } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.toml b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.toml deleted file mode 100644 index 6690c213..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation/update.toml +++ /dev/null @@ -1,58 +0,0 @@ -version = 0 -name = "Update" -documentation = "Update performs an update operation." - -[properties] -enabled = ["write concern"] -retryable = {mode = "once per command", type = "writes"} -batches = "updates" - -[command] -name = "update" -parameter = "collection" - -[request.updates] -type = "document" -slice = true -constructor = true -variadic = true -required = true -documentation = """ -Updates specifies an array of update statements to perform when this operation is executed. -Each update document must have the following structure: {q: , u: , multi: , collation: Optional, arrayFitlers: Optional, hint: Optional}.\ -""" - -[request.ordered] -type = "boolean" -documentation = """ -Ordered sets ordered. If true, when a write fails, the operation will return the error, when -false write failures do not stop execution of the operation.\ -""" - -[request.bypassDocumentValidation] -type = "boolean" -minWireVersion = 4 -documentation = """ -BypassDocumentValidation allows the operation to opt-out of document level validation. Valid -for server versions >= 3.2. For servers < 3.2, this setting is ignored.\ -""" - -[request.hint] -type = "boolean" -minWireVersionRequired = 5 -documentation = """ -Hint is a flag to indicate that the update document contains a hint. Hint is only supported by -servers >= 4.2. Older servers >= 3.4 will report an error for using the hint option. For servers < -3.4, the driver will return an error if the hint option is used.\ -""" - -[response] -name = "UpdateResult" - -[response.field.n] -type = "int32" -documentation = "Number of documents matched." - -[response.field.nModified] -type = "int32" -documentation = "Number of documents modified." diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go index a4390d05..2584f484 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/operation_legacy.go @@ -97,7 +97,7 @@ func (op Operation) createLegacyFindWireMessage(dst []byte, desc description.Sel // build options as a byte slice of elements rather than a bsoncore.Document because they will be appended // to another document with $query var optsElems []byte - flags := op.slaveOK(desc) + flags := op.secondaryOK(desc) var numToSkip, numToReturn, batchSize, limit int32 // numToReturn calculated from batchSize and limit var filter, returnFieldsSelector bsoncore.Document var collName string @@ -162,7 +162,7 @@ func (op Operation) createLegacyFindWireMessage(dst []byte, desc description.Sel numToReturn = op.calculateNumberToReturn(limit, batchSize) // add read preference if needed - rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, true) + rp, err := op.createReadPref(desc, true) if err != nil { return dst, info, "", err } @@ -451,7 +451,7 @@ func (op Operation) createLegacyListCollectionsWiremessage(dst []byte, desc desc if err != nil { return dst, info, "", err } - rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, true) + rp, err := op.createReadPref(desc, true) if err != nil { return dst, info, "", err } @@ -466,7 +466,7 @@ func (op Operation) createLegacyListCollectionsWiremessage(dst []byte, desc desc var wmIdx int32 wmIdx, dst = wiremessage.AppendHeaderStart(dst, info.requestID, 0, wiremessage.OpQuery) - dst = wiremessage.AppendQueryFlags(dst, op.slaveOK(desc)) + dst = wiremessage.AppendQueryFlags(dst, op.secondaryOK(desc)) dst = wiremessage.AppendQueryFullCollectionName(dst, op.getFullCollectionName(listCollectionsNamespace)) dst = wiremessage.AppendQueryNumberToSkip(dst, 0) dst = wiremessage.AppendQueryNumberToReturn(dst, batchSize) @@ -607,7 +607,7 @@ func (op Operation) createLegacyListIndexesWiremessage(dst []byte, desc descript filter = bsoncore.AppendStringElement(filter, "ns", op.getFullCollectionName(filterCollName)) filter, _ = bsoncore.AppendDocumentEnd(filter, fidx) - rp, err := op.createReadPref(desc.Server.Kind, desc.Kind, true) + rp, err := op.createReadPref(desc, true) if err != nil { return dst, info, "", err } @@ -617,7 +617,7 @@ func (op Operation) createLegacyListIndexesWiremessage(dst []byte, desc descript var wmIdx int32 wmIdx, dst = wiremessage.AppendHeaderStart(dst, info.requestID, 0, wiremessage.OpQuery) - dst = wiremessage.AppendQueryFlags(dst, op.slaveOK(desc)) + dst = wiremessage.AppendQueryFlags(dst, op.secondaryOK(desc)) dst = wiremessage.AppendQueryFullCollectionName(dst, op.getFullCollectionName(listIndexesNamespace)) dst = wiremessage.AppendQueryNumberToSkip(dst, 0) dst = wiremessage.AppendQueryNumberToReturn(dst, batchSize) diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go index 64adeb71..3449c85e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/client_session.go @@ -95,6 +95,7 @@ type LoadBalancedTransactionConnection interface { Description() description.Server Close() error ID() string + ServerConnectionID() *int32 Address() address.Address Stale() bool @@ -345,8 +346,6 @@ func (c *Client) EndSession() { c.Terminated = true c.pool.ReturnSession(c.Server) - - return } // TransactionInProgress returns true if the client session is in an active transaction. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go index e7881fa1..54152ea0 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/session/server_session.go @@ -9,15 +9,11 @@ package session import ( "time" - "crypto/rand" - "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/bsonx/bsoncore" "go.mongodb.org/mongo-driver/x/mongo/driver/uuid" ) -var rander = rand.Reader - // Server is an open session with the server. type Server struct { SessionID bsoncore.Document diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go index bd08b9a5..732be09b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection.go @@ -18,7 +18,6 @@ import ( "sync/atomic" "time" - "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/internal" "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" @@ -32,7 +31,7 @@ var globalConnectionID uint64 = 1 var ( defaultMaxMessageSize uint32 = 48000000 - errResponseTooLarge error = errors.New("length of read message too large") + errResponseTooLarge = errors.New("length of read message too large") errLoadBalancedStateMismatch = errors.New("driver attempted to initialize in load balancing mode, but the server does not support this mode") ) @@ -51,9 +50,8 @@ type connection struct { idleDeadline atomic.Value // Stores a time.Time readTimeout time.Duration writeTimeout time.Duration - descMu sync.RWMutex // Guards desc. TODO: Remove with or after GODRIVER-2038. desc description.Server - isMasterRTT time.Duration + helloRTT time.Duration compressor wiremessage.CompressorID zliblevel int zstdLevel int @@ -66,13 +64,12 @@ type connection struct { currentlyStreaming bool connectContextMutex sync.Mutex cancellationListener cancellationListener + serverConnectionID *int32 // the server's ID for this client's connection // pool related fields - pool *pool - poolID uint64 - generation uint64 - expireReason string - poolMonitor *event.PoolMonitor + pool *pool + poolID uint64 + generation uint64 } // newConnection handles the creation of a connection. It does not connect the connection. @@ -94,7 +91,6 @@ func newConnection(addr address.Address, opts ...ConnectionOption) (*connection, config: cfg, connectContextMade: make(chan struct{}), cancellationListener: internal.NewCancellationListener(), - poolMonitor: cfg.poolMonitor, } // Connections to non-load balanced deployments should eagerly set the generation numbers so errors encountered // at any point during connection establishment can be processed without the connection being considered stale. @@ -106,7 +102,7 @@ func newConnection(addr address.Address, opts ...ConnectionOption) (*connection, return c, nil } -func (c *connection) processInitializationError(opCtx context.Context, err error) { +func (c *connection) processInitializationError(err error) { atomic.StoreInt64(&c.connected, disconnected) if c.nc != nil { _ = c.nc.Close() @@ -114,7 +110,7 @@ func (c *connection) processInitializationError(opCtx context.Context, err error c.connectErr = ConnectionError{Wrapped: err, init: true} if c.config.errorHandlingCallback != nil { - c.config.errorHandlingCallback(opCtx, c.connectErr, c.generation, c.desc.ServiceID) + c.config.errorHandlingCallback(c.connectErr, c.generation, c.desc.ServiceID) } } @@ -189,7 +185,7 @@ func (c *connection) connect(ctx context.Context) { var tempNc net.Conn tempNc, err = c.config.dialer.DialContext(dialCtx, c.addr.Network(), c.addr.String()) if err != nil { - c.processInitializationError(ctx, err) + c.processInitializationError(err) return } c.nc = tempNc @@ -205,7 +201,7 @@ func (c *connection) connect(ctx context.Context) { } tlsNc, err := configureTLS(dialCtx, c.config.tlsConnectionSource, c.nc, c.addr, tlsConfig, ocspOpts) if err != nil { - c.processInitializationError(ctx, err) + c.processInitializationError(err) return } c.nc = tlsNc @@ -213,16 +209,9 @@ func (c *connection) connect(ctx context.Context) { c.bumpIdleDeadline() - // running isMaster and authentication is handled by a handshaker on the configuration instance. + // running hello and authentication is handled by a handshaker on the configuration instance. handshaker := c.config.handshaker if handshaker == nil { - if c.poolMonitor != nil { - c.poolMonitor.Event(&event.PoolEvent{ - Type: event.ConnectionReady, - Address: c.addr.String(), - ConnectionID: c.poolID, - }) - } return } @@ -233,10 +222,9 @@ func (c *connection) connect(ctx context.Context) { if err == nil { // We only need to retain the Description field as the connection's description. The authentication-related // fields in handshakeInfo are tracked by the handshaker if necessary. - c.descMu.Lock() c.desc = handshakeInfo.Description - c.descMu.Unlock() - c.isMasterRTT = time.Since(handshakeStartTime) + c.serverConnectionID = handshakeInfo.ServerConnectionID + c.helloRTT = time.Since(handshakeStartTime) // If the application has indicated that the cluster is load balanced, ensure the server has included serviceId // in its handshake response to signal that it knows it's behind an LB as well. @@ -259,7 +247,7 @@ func (c *connection) connect(ctx context.Context) { // We have a failed handshake here if err != nil { - c.processInitializationError(ctx, err) + c.processInitializationError(err) return } @@ -291,13 +279,6 @@ func (c *connection) connect(ctx context.Context) { } } } - if c.poolMonitor != nil { - c.poolMonitor.Event(&event.PoolEvent{ - Type: event.ConnectionReady, - Address: c.addr.String(), - ConnectionID: c.poolID, - }) - } } func (c *connection) wait() error { @@ -480,7 +461,7 @@ func (c *connection) read(ctx context.Context, dst []byte) (bytesRead []byte, er // read the length as an int32 size := (int32(sizeBuf[0])) | (int32(sizeBuf[1]) << 8) | (int32(sizeBuf[2]) << 16) | (int32(sizeBuf[3]) << 24) - // In the case of an isMaster response where MaxMessageSize has not yet been set, use the hard-coded + // In the case of a hello response where MaxMessageSize has not yet been set, use the hard-coded // defaultMaxMessageSize instead. maxMessageSize := c.desc.MaxMessageSize if maxMessageSize == 0 { @@ -568,6 +549,10 @@ func (c *connection) ID() string { return c.id } +func (c *connection) ServerConnectionID() *int32 { + return c.serverConnectionID +} + // initConnection is an adapter used during connection initialization. It has the minimum // functionality necessary to implement the driver.Connection interface, which is required to pass a // *connection to a Handshaker. @@ -711,7 +696,7 @@ func (c *Connection) Expire() error { } func (c *Connection) cleanupReferences() error { - err := c.pool.put(c.connection) + err := c.pool.checkIn(c.connection) if c.cleanupPoolFn != nil { c.cleanupPoolFn() c.cleanupPoolFn = nil @@ -814,9 +799,6 @@ func (c *Connection) unpin(reason string) error { return nil } -var notMasterCodes = []int32{10107, 13435} -var recoveringCodes = []int32{11600, 11602, 13436, 189, 91} - func configureTLS(ctx context.Context, tlsConnSource tlsConnectionSource, nc net.Conn, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_legacy_command_metadata.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_legacy_command_metadata.go deleted file mode 100644 index dc333efb..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_legacy_command_metadata.go +++ /dev/null @@ -1,28 +0,0 @@ -package topology - -import "time" - -// commandMetadata contains metadata about a command sent to the server. -type commandMetadata struct { - Name string - Time time.Time - Legacy bool - FullCollectionName string -} - -// createMetadata creates metadata for a command. -func createMetadata(name string, legacy bool, fullCollName string) *commandMetadata { - return &commandMetadata{ - Name: name, - Time: time.Now(), - Legacy: legacy, - FullCollectionName: fullCollName, - } -} - -// TimeDifference returns the difference between now and the time a command was sent in nanoseconds. -func (cm *commandMetadata) TimeDifference() int64 { - t := time.Now() - duration := t.Sub(cm.Time) - return duration.Nanoseconds() -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go index b9dac8c4..9c6ce05c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/connection_options.go @@ -40,13 +40,11 @@ type Handshaker = driver.Handshaker type generationNumberFn func(serviceID *primitive.ObjectID) uint64 type connectionConfig struct { - appName string connectTimeout time.Duration dialer Dialer handshaker Handshaker idleTimeout time.Duration cmdMonitor *event.CommandMonitor - poolMonitor *event.PoolMonitor readTimeout time.Duration writeTimeout time.Duration tlsConfig *tls.Config @@ -55,7 +53,7 @@ type connectionConfig struct { zstdLevel *int ocspCache ocsp.Cache disableOCSPEndpointCheck bool - errorHandlingCallback func(opCtx context.Context, err error, startGenNum uint64, svcID *primitive.ObjectID) + errorHandlingCallback func(err error, startGenNum uint64, svcID *primitive.ObjectID) tlsConnectionSource tlsConnectionSource loadBalanced bool getGenerationFn generationNumberFn @@ -92,7 +90,7 @@ func withTLSConnectionSource(fn func(tlsConnectionSource) tlsConnectionSource) C } } -func withErrorHandlingCallback(fn func(opCtx context.Context, err error, startGenNum uint64, svcID *primitive.ObjectID)) ConnectionOption { +func withErrorHandlingCallback(fn func(err error, startGenNum uint64, svcID *primitive.ObjectID)) ConnectionOption { return func(c *connectionConfig) error { c.errorHandlingCallback = fn return nil @@ -173,14 +171,6 @@ func WithMonitor(fn func(*event.CommandMonitor) *event.CommandMonitor) Connectio } } -// withPoolMonitor configures a event for connection monitoring. -func withPoolMonitor(fn func(*event.PoolMonitor) *event.PoolMonitor) ConnectionOption { - return func(c *connectionConfig) error { - c.poolMonitor = fn(c.poolMonitor) - return nil - } -} - // WithZlibLevel sets the zLib compression level. func WithZlibLevel(fn func(*int) *int) ConnectionOption { return func(c *connectionConfig) error { diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go index f3e2e3a7..cf0778bd 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/errors.go @@ -66,6 +66,7 @@ type WaitQueueTimeoutError struct { PinnedCursorConnections uint64 PinnedTransactionConnections uint64 maxPoolSize uint64 + totalConnectionCount int } // Error implements the error interface. @@ -75,10 +76,14 @@ func (w WaitQueueTimeoutError) Error() string { errorMsg = fmt.Sprintf("%s: %s", errorMsg, w.Wrapped.Error()) } - errorMsg = fmt.Sprintf("%s; maxPoolSize: %d, connections in use by cursors: %d, connections in use by transactions: %d", - errorMsg, w.maxPoolSize, w.PinnedCursorConnections, w.PinnedTransactionConnections) - return fmt.Sprintf("%s, connections in use by other operations: %d", errorMsg, - w.maxPoolSize-(w.PinnedCursorConnections+w.PinnedTransactionConnections)) + return fmt.Sprintf( + "%s; maxPoolSize: %d, connections in use by cursors: %d"+ + ", connections in use by transactions: %d, connections in use by other operations: %d", + errorMsg, + w.maxPoolSize, + w.PinnedCursorConnections, + w.PinnedTransactionConnections, + uint64(w.totalConnectionCount)-w.PinnedCursorConnections-w.PinnedTransactionConnections) } // Unwrap returns the underlying error. diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go index 7a7f7b3c..004eb21e 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/fsm.go @@ -18,7 +18,7 @@ import ( var ( // SupportedWireVersions is the range of wire versions supported by the driver. - SupportedWireVersions = description.NewVersionRange(2, 13) + SupportedWireVersions = description.NewVersionRange(2, 14) ) const ( @@ -185,7 +185,7 @@ func (f *fsm) applyToSingle(s description.Server) description.Server { f.replaceServer(s) case description.RSPrimary, description.RSSecondary, description.RSArbiter, description.RSMember, description.RSGhost: // A replica set name can be provided when creating a direct connection. In this case, if the set name returned - // by the isMaster response doesn't match up with the one provided during configuration, the server description + // by the hello response doesn't match up with the one provided during configuration, the server description // is replaced with a default Unknown description. // // We create a new server description rather than doing s.Kind = description.Unknown because the other fields, @@ -239,7 +239,7 @@ func (f *fsm) updateRSFromPrimary(s description.Server) { return } - if s.SetVersion != 0 && !bytes.Equal(s.ElectionID[:], primitive.NilObjectID[:]) { + if s.SetVersion != 0 && !s.ElectionID.IsZero() { if f.maxSetVersion > s.SetVersion || bytes.Compare(f.maxElectionID[:], s.ElectionID[:]) == 1 { f.replaceServer(description.Server{ Addr: s.Addr, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go index ae5d65f2..a652594b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/pool.go @@ -8,7 +8,7 @@ package topology import ( "context" - "math" + "fmt" "sync" "sync/atomic" "time" @@ -16,7 +16,6 @@ import ( "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/event" "go.mongodb.org/mongo-driver/mongo/address" - "golang.org/x/sync/semaphore" ) // ErrPoolConnected is returned from an attempt to connect an already connected pool @@ -35,242 +34,229 @@ var ErrWrongPool = PoolError("connection does not belong to this pool") // PoolError is an error returned from a Pool method. type PoolError string -// maintainInterval is the interval at which the background routine to close stale connections will be run. -var maintainInterval = time.Minute - func (pe PoolError) Error() string { return string(pe) } // poolConfig contains all aspects of the pool that can be configured type poolConfig struct { - Address address.Address - MinPoolSize uint64 - MaxPoolSize uint64 // MaxPoolSize is not used because handling the max number of connections in the pool is handled in server. This is only used for command monitoring - MaxIdleTime time.Duration - PoolMonitor *event.PoolMonitor + Address address.Address + MinPoolSize uint64 + MaxPoolSize uint64 + MaxConnecting uint64 + MaxIdleTime time.Duration + PoolMonitor *event.PoolMonitor } -// checkOutResult is all the values that can be returned from a checkOut -type checkOutResult struct { - c *connection - err error - reason string -} - -// pool is a wrapper of resource pool that follows the CMAP spec for connection pools type pool struct { - // These fields must be accessed using the atomic package and should be at the beginning of the struct. + // The following integer fields must be accessed using the atomic package + // and should be at the beginning of the struct. // - atomic bug: https://pkg.go.dev/sync/atomic#pkg-note-BUG // - suggested layout: https://go101.org/article/memory-layout.html - connected int64 + + connected int64 // connected is the connected state of the connection pool. + nextID uint64 // nextID is the next pool ID for a new connection. pinnedCursorConnections uint64 pinnedTransactionConnections uint64 - nextid uint64 - opened map[uint64]*connection // opened holds all of the currently open connections. - sem *semaphore.Weighted - sync.Mutex + address address.Address + minSize uint64 + maxSize uint64 + maxConnecting uint64 + monitor *event.PoolMonitor - address address.Address - opts []ConnectionOption - conns *resourcePool // pool for non-checked out connections + connOpts []ConnectionOption generation *poolGenerationMap - monitor *event.PoolMonitor + + maintainInterval time.Duration // maintainInterval is the maintain() loop interval. + cancelBackground context.CancelFunc // cancelBackground is called to signal background goroutines to stop. + backgroundDone *sync.WaitGroup // backgroundDone waits for all background goroutines to return. + + connsCond *sync.Cond // connsCond guards conns, newConnWait. + conns map[uint64]*connection // conns holds all currently open connections. + newConnWait wantConnQueue // newConnWait holds all wantConn requests for new connections. + + idleMu sync.Mutex // idleMu guards idleConns, idleConnWait + idleConns []*connection // idleConns holds all idle connections. + idleConnWait wantConnQueue // idleConnWait holds all wantConn requests for idle connections. } -// connectionExpiredFunc checks if a given connection is stale and should be removed from the resource pool -func connectionExpiredFunc(v interface{}) bool { - if v == nil { - return true - } - - c, ok := v.(*connection) - if !ok { - return true - } - +// connectionPerished checks if a given connection is perished and should be removed from the pool. +func connectionPerished(conn *connection) (string, bool) { switch { - case atomic.LoadInt64(&c.pool.connected) != connected: - c.expireReason = event.ReasonPoolClosed - case c.closed(): + case atomic.LoadInt64(&conn.pool.connected) != connected: + return event.ReasonPoolClosed, true + case conn.closed(): // A connection would only be closed if it encountered a network error during an operation and closed itself. - c.expireReason = event.ReasonConnectionErrored - case c.idleTimeoutExpired(): - c.expireReason = event.ReasonIdle - case c.pool.stale(c): - c.expireReason = event.ReasonStale - default: - return false + return event.ReasonConnectionErrored, true + case conn.idleTimeoutExpired(): + return event.ReasonIdle, true + case conn.pool.stale(conn): + return event.ReasonStale, true } - - return true + return "", false } -// connectionCloseFunc closes a given connection. If ctx is nil, the closing will occur in the background -func connectionCloseFunc(v interface{}) { - c, ok := v.(*connection) - if !ok || v == nil { - return - } - - // The resource pool will only close connections if they're expired or the pool is being disconnected and - // resourcePool.Close() is called. For the former case, c.expireReason will be set. In the latter, it will not, so - // we use ReasonPoolClosed. - reason := c.expireReason - if c.expireReason == "" { - reason = event.ReasonPoolClosed - } - - _ = c.pool.removeConnection(c, reason) - go func() { - _ = c.pool.closeConnection(c) - }() -} - -// connectionInitFunc returns an init function for the resource pool that will make new connections for this pool -func (p *pool) connectionInitFunc() interface{} { - c, _, err := p.makeNewConnection() - if err != nil { - return nil - } - - go c.connect(context.Background()) - - return c -} - -// newPool creates a new pool that will hold size number of idle connections. It will use the -// provided options when creating connections. -func newPool(config poolConfig, connOpts ...ConnectionOption) (*pool, error) { - opts := connOpts +// newPool creates a new pool. It will use the provided options when creating connections. +func newPool(config poolConfig, connOpts ...ConnectionOption) *pool { if config.MaxIdleTime != time.Duration(0) { - opts = append(opts, WithIdleTimeout(func(_ time.Duration) time.Duration { return config.MaxIdleTime })) - } - if config.PoolMonitor != nil { - opts = append(opts, withPoolMonitor(func(_ *event.PoolMonitor) *event.PoolMonitor { return config.PoolMonitor })) + connOpts = append(connOpts, WithIdleTimeout(func(_ time.Duration) time.Duration { return config.MaxIdleTime })) } - var maxConns = config.MaxPoolSize - if maxConns == 0 { - maxConns = math.MaxInt64 + var maxConnecting uint64 = 2 + if config.MaxConnecting > 0 { + maxConnecting = config.MaxConnecting } pool := &pool{ - address: config.Address, - monitor: config.PoolMonitor, - connected: disconnected, - opened: make(map[uint64]*connection), - opts: opts, - sem: semaphore.NewWeighted(int64(maxConns)), - generation: newPoolGenerationMap(), - } - pool.opts = append(pool.opts, withGenerationNumberFn(func(_ generationNumberFn) generationNumberFn { return pool.getGenerationForNewConnection })) - - // we do not pass in config.MaxPoolSize because we manage the max size at this level rather than the resource pool level - rpc := resourcePoolConfig{ - MaxSize: maxConns, - MinSize: config.MinPoolSize, - MaintainInterval: maintainInterval, - ExpiredFn: connectionExpiredFunc, - CloseFn: connectionCloseFunc, - InitFn: pool.connectionInitFunc, + address: config.Address, + minSize: config.MinPoolSize, + maxSize: config.MaxPoolSize, + maxConnecting: maxConnecting, + monitor: config.PoolMonitor, + connOpts: connOpts, + generation: newPoolGenerationMap(), + connected: disconnected, + maintainInterval: 10 * time.Second, + connsCond: sync.NewCond(&sync.Mutex{}), + conns: make(map[uint64]*connection, config.MaxPoolSize), + idleConns: make([]*connection, 0, config.MaxPoolSize), } + pool.connOpts = append(pool.connOpts, withGenerationNumberFn(func(_ generationNumberFn) generationNumberFn { return pool.getGenerationForNewConnection })) if pool.monitor != nil { pool.monitor.Event(&event.PoolEvent{ Type: event.PoolCreated, PoolOptions: &event.MonitorPoolOptions{ - MaxPoolSize: rpc.MaxSize, - MinPoolSize: rpc.MinSize, - WaitQueueTimeoutMS: uint64(config.MaxIdleTime) / uint64(time.Millisecond), + MaxPoolSize: config.MaxPoolSize, + MinPoolSize: config.MinPoolSize, }, Address: pool.address.String(), }) } - rp, err := newResourcePool(rpc) - if err != nil { - return nil, err - } - pool.conns = rp - - return pool, nil + return pool } // stale checks if a given connection's generation is below the generation of the pool -func (p *pool) stale(c *connection) bool { - if c == nil { - return true - } - - c.descMu.RLock() - serviceID := c.desc.ServiceID - c.descMu.RUnlock() - return p.generation.stale(serviceID, c.generation) +func (p *pool) stale(conn *connection) bool { + return conn == nil || p.generation.stale(conn.desc.ServiceID, conn.generation) } -// connect puts the pool into the connected state, allowing it to be used and will allow items to begin being processed from the wait queue +// connect puts the pool into the connected state and starts the background connection creation and +// monitoring goroutines. connect must be called before connections can be checked out. An unused, +// connected pool must be disconnected or it will leak goroutines and will not be garbage collected. func (p *pool) connect() error { - if !atomic.CompareAndSwapInt64(&p.connected, disconnected, connected) { + if !atomic.CompareAndSwapInt64(&p.connected, disconnected, connecting) { return ErrPoolConnected } p.generation.connect() - p.conns.initialize() + + // Create a Context with cancellation that's used to signal the createConnections() and + // maintain() background goroutines to stop. Also create a "backgroundDone" WaitGroup that is + // used to wait for the background goroutines to return. Always create a new Context and + // WaitGroup each time we start new set of background goroutines to prevent interaction between + // current and previous sets of background goroutines. + var ctx context.Context + ctx, p.cancelBackground = context.WithCancel(context.Background()) + p.backgroundDone = &sync.WaitGroup{} + + for i := 0; i < int(p.maxConnecting); i++ { + p.backgroundDone.Add(1) + go p.createConnections(ctx, p.backgroundDone) + } + p.backgroundDone.Add(1) + go p.maintain(ctx, p.backgroundDone) + + atomic.StoreInt64(&p.connected, connected) return nil } -// disconnect disconnects the pool and closes all connections including those both in and out of the pool +// disconnect disconnects the pool, closes all connections associated with the pool, and stops all +// background goroutines. All subsequent checkOut requests will return an error. An unused, +// connected pool must be disconnected or it will leak goroutines and will not be garbage collected. func (p *pool) disconnect(ctx context.Context) error { if !atomic.CompareAndSwapInt64(&p.connected, connected, disconnecting) { return ErrPoolDisconnected } + // Call cancelBackground() to exit the maintain() background goroutine and broadcast to the + // connsCond to wake up all createConnections() goroutines. We must hold the connsCond lock here + // because we're changing the condition by cancelling the "background goroutine" Context, even + // tho cancelling the Context is also synchronized by a lock. Otherwise, we run into an + // intermittent bug that prevents the createConnections() goroutines from exiting. + p.connsCond.L.Lock() + p.cancelBackground() + p.connsCond.L.Unlock() + p.connsCond.Broadcast() + // Wait for all background goroutines to exit. + p.backgroundDone.Wait() + + p.generation.disconnect() + if ctx == nil { ctx = context.Background() } - p.conns.Close() - p.generation.disconnect() - - var err error - if dl, ok := ctx.Deadline(); ok { - // If we have a deadline then we interpret it as a request to gracefully shutdown. We wait - // until either all the connections have landed back in the pool (and have been closed) or - // until the timer is done. - ticker := time.NewTicker(1 * time.Second) + // If we have a deadline then we interpret it as a request to gracefully shutdown. We wait until + // either all the connections have been checked back into the pool (i.e. total open connections + // equals idle connections) or until the Context deadline is reached. + if _, ok := ctx.Deadline(); ok { + ticker := time.NewTicker(100 * time.Millisecond) defer ticker.Stop() - timer := time.NewTimer(time.Now().Sub(dl)) - defer timer.Stop() + + graceful: for { + if p.totalConnectionCount() == p.availableConnectionCount() { + break graceful + } + select { - case <-timer.C: + case <-ticker.C: case <-ctx.Done(): - case <-ticker.C: // Can we replace this with an actual signal channel? We will know when p.inflight hits zero from the close method. - p.Lock() - if len(p.opened) > 0 { - p.Unlock() - continue - } - p.Unlock() + break graceful + default: } - break } } - // We copy the remaining connections into a slice, then iterate it to close them. This allows us - // to use a single function to actually clean up and close connections at the expense of a - // double iteration in the worse case. - p.Lock() - toClose := make([]*connection, 0, len(p.opened)) - for _, pc := range p.opened { - toClose = append(toClose, pc) + // Empty the idle connections stack and try to deliver ErrPoolDisconnected to any waiting + // wantConns from idleConnWait while holding the idleMu lock. + p.idleMu.Lock() + p.idleConns = p.idleConns[:0] + for { + w := p.idleConnWait.popFront() + if w == nil { + break + } + w.tryDeliver(nil, ErrPoolDisconnected) } - p.Unlock() - for _, pc := range toClose { - _ = p.removeConnection(pc, event.ReasonPoolClosed) - _ = p.closeConnection(pc) // We don't care about errors while closing the connection. + p.idleMu.Unlock() + + // Collect all conns from the pool and try to deliver ErrPoolDisconnected to any waiting + // wantConns from newConnWait while holding the connsCond lock. We can't call removeConnection + // on the connections or cancel on the wantConns while holding any locks, so do that after we + // release the lock. + p.connsCond.L.Lock() + conns := make([]*connection, 0, len(p.conns)) + for _, conn := range p.conns { + conns = append(conns, conn) } + for { + w := p.newConnWait.popFront() + if w == nil { + break + } + w.tryDeliver(nil, ErrPoolDisconnected) + } + p.connsCond.L.Unlock() + + // Now that we're not holding any locks, remove all of the connections we collected from the + // pool. + for _, conn := range conns { + _ = p.removeConnection(conn, event.ReasonPoolClosed) + _ = p.closeConnection(conn) // We don't care about errors while closing the connection. + } + atomic.StoreInt64(&p.connected, disconnected) - p.conns.clearTotal() if p.monitor != nil { p.monitor.Event(&event.PoolEvent{ @@ -279,51 +265,7 @@ func (p *pool) disconnect(ctx context.Context) error { }) } - return err -} - -// makeNewConnection creates a new connection instance and emits a ConnectionCreatedEvent. The caller must call -// connection.connect on the returned instance before using it for operations. This function ensures that a -// ConnectionClosed event is published if there is an error after the ConnectionCreated event has been published. The -// caller must not hold the pool lock when calling this function. -func (p *pool) makeNewConnection() (*connection, string, error) { - c, err := newConnection(p.address, p.opts...) - if err != nil { - return nil, event.ReasonConnectionErrored, err - } - - c.pool = p - c.poolID = atomic.AddUint64(&p.nextid, 1) - - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.ConnectionCreated, - Address: p.address.String(), - ConnectionID: c.poolID, - }) - } - - if atomic.LoadInt64(&p.connected) != connected { - // Manually publish a ConnectionClosed event here because the connection reference hasn't been stored and we - // need to ensure each ConnectionCreated event has a corresponding ConnectionClosed event. - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.ConnectionClosed, - Address: p.address.String(), - ConnectionID: c.poolID, - Reason: event.ReasonPoolClosed, - }) - } - _ = p.closeConnection(c) // The pool is disconnected or disconnecting, ignore the error from closing the connection. - return nil, event.ReasonPoolClosed, ErrPoolDisconnected - } - - p.Lock() - p.opened[c.poolID] = c - p.Unlock() - - return c, "", nil - + return nil } func (p *pool) pinConnectionToCursor() { @@ -344,12 +286,11 @@ func (p *pool) unpinConnectionFromTransaction() { atomic.AddUint64(&p.pinnedTransactionConnections, ^uint64(0)) } -// Checkout returns a connection from the pool -func (p *pool) get(ctx context.Context) (*connection, error) { - if ctx == nil { - ctx = context.Background() - } - +// checkOut checks out a connection from the pool. If an idle connection is not available, the +// checkOut enters a queue waiting for either the next idle or new connection. If the pool is +// disconnected, checkOut returns an error. +// Based partially on https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/http/transport.go;l=1324 +func (p *pool) checkOut(ctx context.Context) (conn *connection, err error) { if atomic.LoadInt64(&p.connected) != connected { if p.monitor != nil { p.monitor.Event(&event.PoolEvent{ @@ -361,8 +302,73 @@ func (p *pool) get(ctx context.Context) (*connection, error) { return nil, ErrPoolDisconnected } - err := p.sem.Acquire(ctx, 1) - if err != nil { + if ctx == nil { + ctx = context.Background() + } + + // Create a wantConn, which we will use to request an existing idle or new connection. Always + // cancel the wantConn if checkOut() returned an error to make sure any delivered connections + // are returned to the pool (e.g. if a connection was delivered immediately after the Context + // timed out). + w := newWantConn() + defer func() { + if err != nil { + w.cancel(p, err) + } + }() + + // Get in the queue for an idle connection. If getOrQueueForIdleConn returns true, it was able to + // immediately deliver an idle connection to the wantConn, so we can return the connection or + // error from the wantConn without waiting for "ready". + if delivered := p.getOrQueueForIdleConn(w); delivered { + if w.err != nil { + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.GetFailed, + Address: p.address.String(), + Reason: event.ReasonConnectionErrored, + }) + } + return nil, w.err + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.GetSucceeded, + Address: p.address.String(), + ConnectionID: w.conn.poolID, + }) + } + return w.conn, nil + } + + // If we didn't get an immediately available idle connection, also get in the queue for a new + // connection while we're waiting for an idle connection. + p.queueForNewConn(w) + + // Wait for either the wantConn to be ready or for the Context to time out. + select { + case <-w.ready: + if w.err != nil { + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.GetFailed, + Address: p.address.String(), + Reason: event.ReasonConnectionErrored, + }) + } + return nil, w.err + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.GetSucceeded, + Address: p.address.String(), + ConnectionID: w.conn.poolID, + }) + } + return w.conn, nil + case <-ctx.Done(): if p.monitor != nil { p.monitor.Event(&event.PoolEvent{ Type: event.GetFailed, @@ -370,151 +376,30 @@ func (p *pool) get(ctx context.Context) (*connection, error) { Reason: event.ReasonTimedOut, }) } - errWaitQueueTimeout := WaitQueueTimeoutError{ + return nil, WaitQueueTimeoutError{ Wrapped: ctx.Err(), PinnedCursorConnections: atomic.LoadUint64(&p.pinnedCursorConnections), PinnedTransactionConnections: atomic.LoadUint64(&p.pinnedTransactionConnections), - maxPoolSize: p.conns.maxSize, - } - return nil, errWaitQueueTimeout - } - - // This loop is so that we don't end up with more than maxPoolSize connections if p.conns.Maintain runs between - // calling p.conns.Get() and making the new connection - for { - if atomic.LoadInt64(&p.connected) != connected { - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetFailed, - Address: p.address.String(), - Reason: event.ReasonPoolClosed, - }) - } - p.sem.Release(1) - return nil, ErrPoolDisconnected - } - - connVal := p.conns.Get() - if c, ok := connVal.(*connection); ok && connVal != nil { - // call connect if not connected - if atomic.LoadInt64(&c.connected) == initialized { - c.connect(ctx) - } - - err := c.wait() - if err != nil { - // Call removeConnection to remove the connection reference and emit a ConnectionClosed event. - _ = p.removeConnection(c, event.ReasonConnectionErrored) - p.conns.decrementTotal() - p.sem.Release(1) - - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetFailed, - Address: p.address.String(), - Reason: event.ReasonConnectionErrored, - }) - } - return nil, err - } - - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetSucceeded, - Address: p.address.String(), - ConnectionID: c.poolID, - }) - } - return c, nil - } - - select { - case <-ctx.Done(): - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetFailed, - Address: p.address.String(), - Reason: event.ReasonTimedOut, - }) - } - p.sem.Release(1) - return nil, ctx.Err() - default: - // The pool is empty, so we try to make a new connection. If incrementTotal fails, the resource pool has - // more resources than we previously thought, so we try to get a resource again. - made := p.conns.incrementTotal() - if !made { - continue - } - c, reason, err := p.makeNewConnection() - - if err != nil { - if p.monitor != nil { - // We only publish a GetFailed event because makeNewConnection has already published - // ConnectionClosed if needed. - p.monitor.Event(&event.PoolEvent{ - Type: event.GetFailed, - Address: p.address.String(), - Reason: reason, - }) - } - p.conns.decrementTotal() - p.sem.Release(1) - return nil, err - } - - c.connect(ctx) - // wait for conn to be connected - err = c.wait() - if err != nil { - // Call removeConnection to remove the connection reference and fire a ConnectionClosedEvent. - _ = p.removeConnection(c, event.ReasonConnectionErrored) - p.conns.decrementTotal() - p.sem.Release(1) - - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetFailed, - Address: p.address.String(), - Reason: event.ReasonConnectionErrored, - }) - } - return nil, err - } - - if p.monitor != nil { - p.monitor.Event(&event.PoolEvent{ - Type: event.GetSucceeded, - Address: p.address.String(), - ConnectionID: c.poolID, - }) - } - return c, nil + maxPoolSize: p.maxSize, + totalConnectionCount: p.totalConnectionCount(), } } } -// closeConnection closes a connection, not the pool itself. This method will actually closeConnection the connection, -// making it unusable, to instead return the connection to the pool, use put. -func (p *pool) closeConnection(c *connection) error { - if c.pool != p { +// closeConnection closes a connection. +func (p *pool) closeConnection(conn *connection) error { + if conn.pool != p { return ErrWrongPool } - if atomic.LoadInt64(&c.connected) == connected { - c.closeConnectContext() - _ = c.wait() // Make sure that the connection has finished connecting + if atomic.LoadInt64(&conn.connected) == connected { + conn.closeConnectContext() + _ = conn.wait() // Make sure that the connection has finished connecting } - if !atomic.CompareAndSwapInt64(&c.connected, connected, disconnected) { - return nil // We're closing an already closed connection - } - - if c.nc != nil { - err := c.nc.Close() - if err != nil { - return ConnectionError{ConnectionID: c.id, Wrapped: err, message: "failed to close net.Conn"} - } + err := conn.close() + if err != nil { + return ConnectionError{ConnectionID: conn.id, Wrapped: err, message: "failed to close net.Conn"} } return nil @@ -524,69 +409,108 @@ func (p *pool) getGenerationForNewConnection(serviceID *primitive.ObjectID) uint return p.generation.addConnection(serviceID) } -// removeConnection removes a connection from the pool. -func (p *pool) removeConnection(c *connection, reason string) error { - if c.pool != p { - return ErrWrongPool - } - - var publishEvent bool - p.Lock() - if _, ok := p.opened[c.poolID]; ok { - publishEvent = true - delete(p.opened, c.poolID) - } - p.Unlock() - - // Only update the generation numbers map if the connection has retrieved its generation number. Otherwise, we'd - // decrement the count for the generation even though it had never been incremented. - if c.hasGenerationNumber() { - c.descMu.RLock() - serviceID := c.desc.ServiceID - c.descMu.RUnlock() - p.generation.removeConnection(serviceID) - } - - if publishEvent && p.monitor != nil { - c.pool.monitor.Event(&event.PoolEvent{ - Type: event.ConnectionClosed, - Address: c.pool.address.String(), - ConnectionID: c.poolID, - Reason: reason, - }) - } - return nil -} - -// put returns a connection to this pool. If the pool is connected, the connection is not -// stale, and there is space in the cache, the connection is returned to the cache. This -// assumes that the connection has already been counted in p.conns.totalSize. -func (p *pool) put(c *connection) error { - defer p.sem.Release(1) - if p.monitor != nil { - var cid uint64 - var addr string - if c != nil { - cid = c.poolID - addr = c.addr.String() - } - p.monitor.Event(&event.PoolEvent{ - Type: event.ConnectionReturned, - ConnectionID: cid, - Address: addr, - }) - } - - if c == nil { +// removeConnection removes a connection from the pool and emits a "ConnectionClosed" event. +func (p *pool) removeConnection(conn *connection, reason string) error { + if conn == nil { return nil } - if c.pool != p { + if conn.pool != p { return ErrWrongPool } - _ = p.conns.Put(c) + p.connsCond.L.Lock() + _, ok := p.conns[conn.poolID] + if !ok { + // If the connection has been removed from the pool already, exit without doing any + // additional state changes. + p.connsCond.L.Unlock() + return nil + } + delete(p.conns, conn.poolID) + // Signal the connsCond so any goroutines waiting for a new connection slot in the pool will + // proceed. + p.connsCond.Signal() + p.connsCond.L.Unlock() + // Only update the generation numbers map if the connection has retrieved its generation number. + // Otherwise, we'd decrement the count for the generation even though it had never been + // incremented. + if conn.hasGenerationNumber() { + p.generation.removeConnection(conn.desc.ServiceID) + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.ConnectionClosed, + Address: p.address.String(), + ConnectionID: conn.poolID, + Reason: reason, + }) + } + + return nil +} + +// checkIn returns an idle connection to the pool. If the connection is perished or the pool is +// disconnected, it is removed from the connection pool and closed. +func (p *pool) checkIn(conn *connection) error { + if conn == nil { + return nil + } + if conn.pool != p { + return ErrWrongPool + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.ConnectionReturned, + ConnectionID: conn.poolID, + Address: conn.addr.String(), + }) + } + + return p.checkInNoEvent(conn) +} + +// checkInNoEvent returns a connection to the pool. It behaves identically to checkIn except it does +// not publish events. It is only intended for use by pool-internal functions. +func (p *pool) checkInNoEvent(conn *connection) error { + if conn == nil { + return nil + } + if conn.pool != p { + return ErrWrongPool + } + + if reason, perished := connectionPerished(conn); perished { + _ = p.removeConnection(conn, reason) + go func() { + _ = p.closeConnection(conn) + }() + return nil + } + + p.idleMu.Lock() + defer p.idleMu.Unlock() + + for { + w := p.idleConnWait.popFront() + if w == nil { + break + } + if w.tryDeliver(conn, nil) { + return nil + } + } + + for _, idle := range p.idleConns { + if idle == conn { + return fmt.Errorf("duplicate idle conn %p in idle connections stack", conn) + } + } + + p.idleConns = append(p.idleConns, conn) return nil } @@ -601,3 +525,405 @@ func (p *pool) clear(serviceID *primitive.ObjectID) { } p.generation.clear(serviceID) } + +// getOrQueueForIdleConn attempts to deliver an idle connection to the given wantConn. If there is +// an idle connection in the idle connections stack, it pops an idle connection, delivers it to the +// wantConn, and returns true. If there are no idle connections in the idle connections stack, it +// adds the wantConn to the idleConnWait queue and returns false. +func (p *pool) getOrQueueForIdleConn(w *wantConn) bool { + p.idleMu.Lock() + defer p.idleMu.Unlock() + + // Try to deliver an idle connection from the idleConns stack first. + for len(p.idleConns) > 0 { + conn := p.idleConns[len(p.idleConns)-1] + p.idleConns = p.idleConns[:len(p.idleConns)-1] + + if conn == nil { + continue + } + + if reason, perished := connectionPerished(conn); perished { + _ = conn.pool.removeConnection(conn, reason) + go func() { + _ = conn.pool.closeConnection(conn) + }() + continue + } + + if !w.tryDeliver(conn, nil) { + // If we couldn't deliver the conn to w, put it back in the idleConns stack. + p.idleConns = append(p.idleConns, conn) + } + + // If we got here, we tried to deliver an idle conn to w. No matter if tryDeliver() returned + // true or false, w is no longer waiting and doesn't need to be added to any wait queues, so + // return delivered = true. + return true + } + + p.idleConnWait.cleanFront() + p.idleConnWait.pushBack(w) + return false +} + +func (p *pool) queueForNewConn(w *wantConn) { + p.connsCond.L.Lock() + defer p.connsCond.L.Unlock() + + p.newConnWait.cleanFront() + p.newConnWait.pushBack(w) + p.connsCond.Signal() +} + +func (p *pool) totalConnectionCount() int { + p.connsCond.L.Lock() + defer p.connsCond.L.Unlock() + + return len(p.conns) +} + +func (p *pool) availableConnectionCount() int { + p.idleMu.Lock() + defer p.idleMu.Unlock() + + return len(p.idleConns) +} + +// createConnections creates connections for wantConn requests on the newConnWait queue. +func (p *pool) createConnections(ctx context.Context, wg *sync.WaitGroup) { + defer wg.Done() + + // condition returns true if the createConnections() loop should continue and false if it should + // wait. Note that the condition also listens for Context cancellation, which also causes the + // loop to continue, allowing for a subsequent check to return from createConnections(). + condition := func() bool { + checkOutWaiting := p.newConnWait.len() > 0 + poolHasSpace := p.maxSize == 0 || uint64(len(p.conns)) < p.maxSize + cancelled := ctx.Err() != nil + return (checkOutWaiting && poolHasSpace) || cancelled + } + + // wait waits for there to be an available wantConn and for the pool to have space for a new + // connection. When the condition becomes true, it creates a new connection and returns the + // waiting wantConn and new connection. If the Context is cancelled or there are any + // errors, wait returns with "ok = false". + wait := func() (*wantConn, *connection, bool) { + p.connsCond.L.Lock() + defer p.connsCond.L.Unlock() + + for !condition() { + p.connsCond.Wait() + } + + if ctx.Err() != nil { + return nil, nil, false + } + + p.newConnWait.cleanFront() + w := p.newConnWait.popFront() + if w == nil { + return nil, nil, false + } + + conn, err := newConnection(p.address, p.connOpts...) + if err != nil { + w.tryDeliver(nil, err) + return nil, nil, false + } + + conn.pool = p + conn.poolID = atomic.AddUint64(&p.nextID, 1) + p.conns[conn.poolID] = conn + + return w, conn, true + } + + for ctx.Err() == nil { + w, conn, ok := wait() + if !ok { + continue + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.ConnectionCreated, + Address: p.address.String(), + ConnectionID: conn.poolID, + }) + } + + conn.connect(context.Background()) + err := conn.wait() + if err != nil { + _ = p.removeConnection(conn, event.ReasonConnectionErrored) + _ = p.closeConnection(conn) + w.tryDeliver(nil, err) + continue + } + + if p.monitor != nil { + p.monitor.Event(&event.PoolEvent{ + Type: event.ConnectionReady, + Address: p.address.String(), + ConnectionID: conn.poolID, + }) + } + + if w.tryDeliver(conn, nil) { + continue + } + + _ = p.checkInNoEvent(conn) + } +} + +func (p *pool) maintain(ctx context.Context, wg *sync.WaitGroup) { + defer wg.Done() + + ticker := time.NewTicker(p.maintainInterval) + defer ticker.Stop() + + // remove removes the *wantConn at index i from the slice and returns the new slice. The order + // of the slice is not maintained. + remove := func(arr []*wantConn, i int) []*wantConn { + end := len(arr) - 1 + arr[i], arr[end] = arr[end], arr[i] + return arr[:end] + } + + // removeNotWaiting removes any wantConns that are no longer waiting from given slice of + // wantConns. That allows maintain() to use the size of its wantConns slice as an indication of + // how many new connection requests are outstanding and subtract that from the number of + // connections to ask for when maintaining minPoolSize. + removeNotWaiting := func(arr []*wantConn) []*wantConn { + for i := len(arr) - 1; i >= 0; i-- { + w := arr[i] + if !w.waiting() { + arr = remove(arr, i) + } + } + + return arr + } + + wantConns := make([]*wantConn, 0, p.minSize) + defer func() { + for _, w := range wantConns { + w.tryDeliver(nil, ErrPoolDisconnected) + } + }() + + for { + p.removePerishedConns() + + // Remove any wantConns that are no longer waiting. + wantConns = removeNotWaiting(wantConns) + + // Figure out how many more wantConns we need to satisfy minPoolSize. Assume that the + // outstanding wantConns (i.e. the ones that weren't removed from the slice) will all return + // connections when they're ready, so only add wantConns to make up the difference. Limit + // the number of connections requested to max 10 at a time to prevent overshooting + // minPoolSize in case other checkOut() calls are requesting new connections, too. + total := p.totalConnectionCount() + n := int(p.minSize) - total - len(wantConns) + if n > 10 { + n = 10 + } + + for i := 0; i < n; i++ { + w := newWantConn() + p.queueForNewConn(w) + wantConns = append(wantConns, w) + + // Start a goroutine for each new wantConn, waiting for it to be ready. + go func() { + <-w.ready + if w.conn != nil { + _ = p.checkInNoEvent(w.conn) + } + }() + } + + // Wait for the next tick at the bottom of the loop so that maintain() runs once immediately + // after connect() is called. Exit the loop if the Context is cancelled. + select { + case <-ticker.C: + case <-ctx.Done(): + return + } + } +} + +func (p *pool) removePerishedConns() { + p.idleMu.Lock() + defer p.idleMu.Unlock() + + for i := range p.idleConns { + conn := p.idleConns[i] + if conn == nil { + continue + } + + if reason, perished := connectionPerished(conn); perished { + p.idleConns[i] = nil + + _ = p.removeConnection(conn, reason) + go func() { + _ = p.closeConnection(conn) + }() + } + } + + p.idleConns = compact(p.idleConns) +} + +// compact removes any nil pointers from the slice and keeps the non-nil pointers, retaining the +// order of the non-nil pointers. +func compact(arr []*connection) []*connection { + offset := 0 + for i := range arr { + if arr[i] == nil { + continue + } + arr[offset] = arr[i] + offset++ + } + return arr[:offset] +} + +// A wantConn records state about a wanted connection (that is, an active call to checkOut). +// The conn may be gotten by creating a new connection or by finding an idle connection, or a +// cancellation may make the conn no longer wanted. These three options are racing against each +// other and use wantConn to coordinate and agree about the winning outcome. +// Based on https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/http/transport.go;l=1174-1240 +type wantConn struct { + ready chan struct{} + + mu sync.Mutex // Guards conn, err + conn *connection + err error +} + +func newWantConn() *wantConn { + return &wantConn{ + ready: make(chan struct{}, 1), + } +} + +// waiting reports whether w is still waiting for an answer (connection or error). +func (w *wantConn) waiting() bool { + select { + case <-w.ready: + return false + default: + return true + } +} + +// tryDeliver attempts to deliver conn, err to w and reports whether it succeeded. +func (w *wantConn) tryDeliver(conn *connection, err error) bool { + w.mu.Lock() + defer w.mu.Unlock() + + if w.conn != nil || w.err != nil { + return false + } + + w.conn = conn + w.err = err + if w.conn == nil && w.err == nil { + panic("x/mongo/driver/topology: internal error: misuse of tryDeliver") + } + close(w.ready) + return true +} + +// cancel marks w as no longer wanting a result (for example, due to cancellation). If a connection +// has been delivered already, cancel returns it with p.checkInNoEvent(). Note that the caller must +// not hold any locks on the pool while calling cancel. +func (w *wantConn) cancel(p *pool, err error) { + if err == nil { + panic("x/mongo/driver/topology: internal error: misuse of cancel") + } + + w.mu.Lock() + if w.conn == nil && w.err == nil { + close(w.ready) // catch misbehavior in future delivery + } + conn := w.conn + w.conn = nil + w.err = err + w.mu.Unlock() + + if conn != nil { + _ = p.checkInNoEvent(conn) + } +} + +// A wantConnQueue is a queue of wantConns. +// Based on https://cs.opensource.google/go/go/+/refs/tags/go1.16.6:src/net/http/transport.go;l=1242-1306 +type wantConnQueue struct { + // This is a queue, not a deque. + // It is split into two stages - head[headPos:] and tail. + // popFront is trivial (headPos++) on the first stage, and + // pushBack is trivial (append) on the second stage. + // If the first stage is empty, popFront can swap the + // first and second stages to remedy the situation. + // + // This two-stage split is analogous to the use of two lists + // in Okasaki's purely functional queue but without the + // overhead of reversing the list when swapping stages. + head []*wantConn + headPos int + tail []*wantConn +} + +// len returns the number of items in the queue. +func (q *wantConnQueue) len() int { + return len(q.head) - q.headPos + len(q.tail) +} + +// pushBack adds w to the back of the queue. +func (q *wantConnQueue) pushBack(w *wantConn) { + q.tail = append(q.tail, w) +} + +// popFront removes and returns the wantConn at the front of the queue. +func (q *wantConnQueue) popFront() *wantConn { + if q.headPos >= len(q.head) { + if len(q.tail) == 0 { + return nil + } + // Pick up tail as new head, clear tail. + q.head, q.headPos, q.tail = q.tail, 0, q.head[:0] + } + w := q.head[q.headPos] + q.head[q.headPos] = nil + q.headPos++ + return w +} + +// peekFront returns the wantConn at the front of the queue without removing it. +func (q *wantConnQueue) peekFront() *wantConn { + if q.headPos < len(q.head) { + return q.head[q.headPos] + } + if len(q.tail) > 0 { + return q.tail[0] + } + return nil +} + +// cleanFront pops any wantConns that are no longer waiting from the head of the +// queue, reporting whether any were popped. +func (q *wantConnQueue) cleanFront() (cleaned bool) { + for { + w := q.peekFront() + if w == nil || w.waiting() { + return cleaned + } + q.popFront() + cleaned = true + } +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/resource_pool.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/resource_pool.go deleted file mode 100644 index b7fcf310..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/resource_pool.go +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (C) MongoDB, Inc. 2017-present. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. You may obtain -// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - -package topology - -import ( - "fmt" - "sync" - "sync/atomic" - "time" -) - -// expiredFunc is the function type used for testing whether or not resources in a resourcePool have stale. It should -// return true if the resource has stale and can be removed from the pool. -type expiredFunc func(interface{}) bool - -// closeFunc is the function type used to closeConnection resources in a resourcePool. The pool will always call this function -// asynchronously -type closeFunc func(interface{}) - -// initFunc is the function used to add a resource to the resource pool to maintain minimum size. It returns a new -// resource each time it is called. -type initFunc func() interface{} - -type resourcePoolConfig struct { - MaxSize uint64 - MinSize uint64 - MaintainInterval time.Duration - ExpiredFn expiredFunc - CloseFn closeFunc - InitFn initFunc -} - -// setup sets defaults in the rpc and checks that the given values are valid -func (rpc *resourcePoolConfig) setup() error { - if rpc.ExpiredFn == nil { - return fmt.Errorf("an ExpiredFn is required to create a resource pool") - } - if rpc.CloseFn == nil { - return fmt.Errorf("an CloseFn is required to create a resource pool") - } - if rpc.MaintainInterval == time.Duration(0) { - return fmt.Errorf("unable to have MaintainInterval time of %v", rpc.MaintainInterval) - } - return nil -} - -// resourcePoolElement is a link list element -type resourcePoolElement struct { - next, prev *resourcePoolElement - value interface{} -} - -// resourcePool is a concurrent resource pool -type resourcePool struct { - start, end *resourcePoolElement - size, minSize, maxSize, totalSize uint64 - expiredFn expiredFunc - closeFn closeFunc - initFn initFunc - maintainTimer *time.Timer - maintainInterval time.Duration - closed bool - - sync.Mutex -} - -// NewResourcePool creates a new resourcePool instance that is capped to maxSize resources. -// If maxSize is 0, the pool size will be unbounded. -func newResourcePool(config resourcePoolConfig) (*resourcePool, error) { - err := (&config).setup() - if err != nil { - return nil, err - } - rp := &resourcePool{ - minSize: config.MinSize, - maxSize: config.MaxSize, - expiredFn: config.ExpiredFn, - closeFn: config.CloseFn, - initFn: config.InitFn, - maintainInterval: config.MaintainInterval, - } - - return rp, nil -} - -func (rp *resourcePool) initialize() { - rp.Lock() - rp.maintainTimer = time.AfterFunc(rp.maintainInterval, rp.Maintain) - rp.Unlock() - - rp.Maintain() -} - -// add will add a new rpe to the pool, requires that the resource pool is locked -func (rp *resourcePool) add(e *resourcePoolElement) { - if e == nil { - e = &resourcePoolElement{ - value: rp.initFn(), - } - } - - e.next = rp.start - if rp.start != nil { - rp.start.prev = e - } - rp.start = e - if rp.end == nil { - rp.end = e - } - atomic.AddUint64(&rp.size, 1) -} - -// Get returns the first un-stale resource from the pool. If no such resource can be found, nil is returned. -func (rp *resourcePool) Get() interface{} { - rp.Lock() - defer rp.Unlock() - - for rp.start != nil { - curr := rp.start - rp.remove(curr) - if !rp.expiredFn(curr.value) { - return curr.value - } - rp.closeFn(curr.value) - rp.totalSize-- - } - return nil -} - -func (rp *resourcePool) incrementTotal() bool { - rp.Lock() - defer rp.Unlock() - if rp.maxSize > 0 && rp.totalSize >= rp.maxSize { - return false - } - rp.totalSize++ - return true -} - -func (rp *resourcePool) decrementTotal() { - rp.Lock() - defer rp.Unlock() - rp.totalSize-- -} - -func (rp *resourcePool) clearTotal() { - rp.Lock() - defer rp.Unlock() - rp.totalSize = 0 -} - -// Put puts the resource back into the pool if it will not exceed the max size of the pool. -// This assumes that v has already been accounted for by rp.totalSize -func (rp *resourcePool) Put(v interface{}) bool { - rp.Lock() - defer rp.Unlock() - if rp.expiredFn(v) { - rp.closeFn(v) - rp.totalSize-- - return false - } - - rp.add(&resourcePoolElement{value: v}) - return true -} - -// remove removes a rpe from the linked list. Requires that the pool be locked -func (rp *resourcePool) remove(e *resourcePoolElement) { - if e == nil { - return - } - - if e.prev != nil { - e.prev.next = e.next - } - if e.next != nil { - e.next.prev = e.prev - } - if e == rp.start { - rp.start = e.next - } - if e == rp.end { - rp.end = e.prev - } - atomicSubtract1Uint64(&rp.size) -} - -// Maintain puts the pool back into a state of having a correct number of resources if possible and removes all stale resources -func (rp *resourcePool) Maintain() { - rp.Lock() - defer rp.Unlock() - - if rp.closed { - return - } - - for curr := rp.end; curr != nil; curr = curr.prev { - if rp.expiredFn(curr.value) { - rp.remove(curr) - rp.closeFn(curr.value) - rp.totalSize-- - } - } - - for rp.totalSize < rp.minSize { - rp.add(nil) - rp.totalSize++ - } - - // reset the timer for the background cleanup routine - if rp.maintainTimer == nil { - rp.maintainTimer = time.AfterFunc(rp.maintainInterval, rp.Maintain) - } - if !rp.maintainTimer.Stop() { - rp.maintainTimer = time.AfterFunc(rp.maintainInterval, rp.Maintain) - return - } - rp.maintainTimer.Reset(rp.maintainInterval) -} - -// Close clears the pool and stops the background maintenance routine. -func (rp *resourcePool) Close() { - rp.Lock() - defer rp.Unlock() - - // Clear the resources in the pool. - for ; rp.start != nil; rp.start = rp.start.next { - rp.closeFn(rp.start.value) - rp.totalSize-- - } - atomic.StoreUint64(&rp.size, 0) - rp.end = nil - - // Stop the maintenance timer. If it's already fired, a call to Maintain might be waiting for the lock to be - // released, so we set closed to make that call a no-op. - rp.closed = true - _ = rp.maintainTimer.Stop() -} - -func atomicSubtract1Uint64(p *uint64) { - if p == nil || atomic.LoadUint64(p) == 0 { - return - } - - for { - expected := atomic.LoadUint64(p) - if atomic.CompareAndSwapUint64(p, expected, expected-1) { - return - } - } -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/rtt_monitor.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/rtt_monitor.go index 40911126..c7963bbf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/rtt_monitor.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/rtt_monitor.go @@ -8,6 +8,7 @@ package topology import ( "context" + "math" "sync" "time" @@ -17,28 +18,43 @@ import ( const ( rttAlphaValue = 0.2 + minSamples = 5 + maxSamples = 500 ) type rttConfig struct { interval time.Duration + minRTTWindow time.Duration // Window size to calculate minimum RTT over. createConnectionFn func() (*connection, error) - createOperationFn func(driver.Connection) *operation.IsMaster + createOperationFn func(driver.Connection) *operation.Hello } type rttMonitor struct { - sync.Mutex - conn *connection + mu sync.RWMutex // mu guards samples, offset, minRTT, averageRTT, and averageRTTSet + samples []time.Duration + offset int + minRTT time.Duration averageRTT time.Duration averageRTTSet bool - closeWg sync.WaitGroup - cfg *rttConfig - ctx context.Context - cancelFn context.CancelFunc + + closeWg sync.WaitGroup + cfg *rttConfig + ctx context.Context + cancelFn context.CancelFunc } -func newRttMonitor(cfg *rttConfig) *rttMonitor { +func newRTTMonitor(cfg *rttConfig) *rttMonitor { + if cfg.interval <= 0 { + panic("RTT monitor interval must be greater than 0") + } + ctx, cancel := context.WithCancel(context.Background()) + // Determine the number of samples we need to keep to store the minWindow of RTT durations. The + // number of samples must be between [5, 500]. + numSamples := int(math.Max(minSamples, math.Min(maxSamples, float64((cfg.minRTTWindow)/cfg.interval)))) + return &rttMonitor{ + samples: make([]time.Duration, numSamples), cfg: cfg, ctx: ctx, cancelFn: cancel, @@ -53,21 +69,6 @@ func (r *rttMonitor) connect() { func (r *rttMonitor) disconnect() { // Signal for the routine to stop. r.cancelFn() - - var conn *connection - r.Lock() - conn = r.conn - r.Unlock() - - if conn != nil { - // If the connection exists, we need to wait for it to be connected. We can ignore the error from conn.wait(). - // If the connection wasn't successfully opened, its state was set back to disconnected, so calling conn.close() - // will be a noop. - conn.closeConnectContext() - _ = conn.wait() - _ = conn.close() - } - r.closeWg.Wait() } @@ -76,77 +77,93 @@ func (r *rttMonitor) start() { ticker := time.NewTicker(r.cfg.interval) defer ticker.Stop() - for { - // The context is only cancelled in disconnect() so if there's an error on it, the monitor is shutting down. - if r.ctx.Err() != nil { - return + var conn *connection + defer func() { + if conn != nil { + // If the connection exists, we need to wait for it to be connected. We can ignore the + // error from conn.wait(). If the connection wasn't successfully opened, its state was + // set back to disconnected, so calling conn.close() will be a noop. + conn.closeConnectContext() + _ = conn.wait() + _ = conn.close() } + }() - r.pingServer() + for { + conn = r.runHello(conn) select { case <-ticker.C: case <-r.ctx.Done(): - // Shutting down return } } } -// reset sets the average RTT to 0. This should only be called from the server monitor when an error occurs during a -// server check. Errors in the RTT monitor should not reset the average RTT. -func (r *rttMonitor) reset() { - r.Lock() - defer r.Unlock() +// runHello runs a "hello" operation using the provided connection, measures the duration, and adds +// the duration as an RTT sample and returns the connection used. If the provided connection is nil +// or closed, runHello tries to establish a new connection. If the "hello" operation returns an +// error, runHello closes the connection. +func (r *rttMonitor) runHello(conn *connection) *connection { + if conn == nil || conn.closed() { + conn, err := r.cfg.createConnectionFn() + if err != nil { + return nil + } + conn.connect(r.ctx) + err = conn.wait() + if err != nil { + _ = conn.close() + return nil + } + + // If we just created a new connection, record the "hello" RTT from the new connection and + // return the new connection. Don't run another "hello" command this interval because it's + // now unnecessary. + r.addSample(conn.helloRTT) + return conn + } + + start := time.Now() + err := r.cfg.createOperationFn(initConnection{conn}).Execute(r.ctx) + if err != nil { + // Errors from the RTT monitor do not reset the RTTs or update the topology, so we close the + // existing connection and recreate it on the next check. + _ = conn.close() + return nil + } + r.addSample(time.Since(start)) + + return conn +} + +// reset sets the average and min RTT to 0. This should only be called from the server monitor when an error +// occurs during a server check. Errors in the RTT monitor should not reset the RTTs. +func (r *rttMonitor) reset() { + r.mu.Lock() + defer r.mu.Unlock() + + for i := range r.samples { + r.samples[i] = 0 + } + r.offset = 0 + r.minRTT = 0 r.averageRTT = 0 r.averageRTTSet = false } -func (r *rttMonitor) setupRttConnection() error { - conn, err := r.cfg.createConnectionFn() - if err != nil { - return err - } - - r.Lock() - r.conn = conn - r.Unlock() - - r.conn.connect(r.ctx) - return r.conn.wait() -} - -func (r *rttMonitor) pingServer() { - if r.conn == nil || r.conn.closed() { - if err := r.setupRttConnection(); err != nil { - return - } - - // Add the initial connection handshake time as an RTT sample. - r.addSample(r.conn.isMasterRTT) - return - } - - // We're using an already established connection. Issue an isMaster command to get a new RTT sample. - rttConn := initConnection{r.conn} - start := time.Now() - err := r.cfg.createOperationFn(rttConn).Execute(r.ctx) - if err != nil { - // Errors from the RTT monitor do not reset the average RTT or update the topology, so we close the existing - // connection and recreate it on the next check. - _ = r.conn.close() - return - } - - r.addSample(time.Since(start)) -} - func (r *rttMonitor) addSample(rtt time.Duration) { // Lock for the duration of this method. We're doing compuationally inexpensive work very infrequently, so lock // contention isn't expected. - r.Lock() - defer r.Unlock() + r.mu.Lock() + defer r.mu.Unlock() + + r.samples[r.offset] = rtt + r.offset = (r.offset + 1) % len(r.samples) + // Set the minRTT as the minimum of all collected samples. Require at least 5 samples before + // setting minRTT to prevent noisy samples on startup from artificially increasing minRTT. + r.minRTT = min(r.samples, minSamples) if !r.averageRTTSet { r.averageRTT = rtt @@ -157,9 +174,38 @@ func (r *rttMonitor) addSample(rtt time.Duration) { r.averageRTT = time.Duration(rttAlphaValue*float64(rtt) + (1-rttAlphaValue)*float64(r.averageRTT)) } +// min returns the minimum value of the slice of duration samples. Zero values are not considered +// samples and are ignored. If no samples or fewer than minSamples are found in the slice, min +// returns 0. +func min(samples []time.Duration, minSamples int) time.Duration { + count := 0 + min := time.Duration(math.MaxInt64) + for _, d := range samples { + if d > 0 { + count++ + } + if d > 0 && d < min { + min = d + } + } + if count == 0 || count < minSamples { + return 0 + } + return min +} + +// getRTT returns the exponentially weighted moving average observed round-trip time. func (r *rttMonitor) getRTT() time.Duration { - r.Lock() - defer r.Unlock() + r.mu.RLock() + defer r.mu.RUnlock() return r.averageRTT } + +// getMinRTT returns the minimum observed round-trip time over the window period. +func (r *rttMonitor) getMinRTT() time.Duration { + r.mu.RLock() + defer r.mu.RUnlock() + + return r.minRTT +} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go index 2149a16b..28453460 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server.go @@ -82,10 +82,15 @@ func connectionStateString(state int64) string { // Server is a single server within a topology. type Server struct { - cfg *serverConfig - address address.Address + // connectionstate must be accessed using the atomic package and should be at the beginning of + // the struct. + // - atomic bug: https://pkg.go.dev/sync/atomic#pkg-note-BUG + // - suggested layout: https://go101.org/article/memory-layout.html connectionstate int64 + cfg *serverConfig + address address.Address + // connection related fields pool *pool @@ -166,27 +171,24 @@ func NewServer(addr address.Address, topologyID primitive.ObjectID, opts ...Serv s.desc.Store(description.NewDefaultServer(addr)) rttCfg := &rttConfig{ interval: cfg.heartbeatInterval, + minRTTWindow: 5 * time.Minute, createConnectionFn: s.createConnection, createOperationFn: s.createBaseOperation, } - s.rttMonitor = newRttMonitor(rttCfg) + s.rttMonitor = newRTTMonitor(rttCfg) pc := poolConfig{ - Address: addr, - MinPoolSize: cfg.minConns, - MaxPoolSize: cfg.maxConns, - MaxIdleTime: cfg.connectionPoolMaxIdleTime, - PoolMonitor: cfg.poolMonitor, + Address: addr, + MinPoolSize: cfg.minConns, + MaxPoolSize: cfg.maxConns, + MaxConnecting: cfg.maxConnecting, + MaxIdleTime: cfg.connectionPoolMaxIdleTime, + PoolMonitor: cfg.poolMonitor, } - connectionOpts := make([]ConnectionOption, len(cfg.connectionOpts)) - copy(connectionOpts, cfg.connectionOpts) + connectionOpts := copyConnectionOpts(cfg.connectionOpts) connectionOpts = append(connectionOpts, withErrorHandlingCallback(s.ProcessHandshakeError)) - s.pool, err = newPool(pc, connectionOpts...) - if err != nil { - return nil, err - } - + s.pool = newPool(pc, connectionOpts...) s.publishServerOpeningEvent(s.address) return s, nil @@ -265,7 +267,7 @@ func (s *Server) Connection(ctx context.Context) (driver.Connection, error) { return nil, ErrServerClosed } - connImpl, err := s.pool.get(ctx) + connImpl, err := s.pool.checkOut(ctx) if err != nil { // The error has already been handled by connection.connect, which calls Server.ProcessHandshakeError. return nil, err @@ -275,10 +277,8 @@ func (s *Server) Connection(ctx context.Context) (driver.Connection, error) { } // ProcessHandshakeError implements SDAM error handling for errors that occur before a connection -// finishes handshaking. opCtx is the context passed to Server.Connection() and is used to determine -// whether or not an operation-scoped context deadline or cancellation was the cause of the -// handshake error; it is not used for timeout or cancellation of ProcessHandshakeError. -func (s *Server) ProcessHandshakeError(opCtx context.Context, err error, startingGenerationNumber uint64, serviceID *primitive.ObjectID) { +// finishes handshaking. +func (s *Server) ProcessHandshakeError(err error, startingGenerationNumber uint64, serviceID *primitive.ObjectID) { // Ignore the error if the server is behind a load balancer but the service ID is unknown. This indicates that the // error happened when dialing the connection or during the MongoDB handshake, so we don't know the service ID to // use for clearing the pool. @@ -295,62 +295,6 @@ func (s *Server) ProcessHandshakeError(opCtx context.Context, err error, startin return } - isCtxTimeoutOrCanceled := func(ctx context.Context) bool { - if ctx == nil { - return false - } - - if ctx.Err() != nil { - return true - } - - // In some networking functions, the deadline from the context is used to determine timeouts - // instead of the ctx.Done() chan closure. In that case, there can be a race condition - // between the networking functing returning an error and ctx.Err() returning an an error - // (i.e. the networking function returns an error caused by the context deadline, but - // ctx.Err() returns nil). If the operation-scoped context deadline was exceeded, assume - // operation-scoped context timeout caused the error. - if deadline, ok := ctx.Deadline(); ok && time.Now().After(deadline) { - return true - } - - return false - } - - isErrTimeoutOrCanceled := func(err error) bool { - for err != nil { - // Check for errors that implement the "net.Error" interface and self-report as timeout - // errors. Includes some "*net.OpError" errors and "context.DeadlineExceeded". - if netErr, ok := err.(net.Error); ok && netErr.Timeout() { - return true - } - // Check for context cancellation. Also handle the case where the cancellation error has - // been replaced by "net.errCanceled" (which isn't exported and can't be compared - // directly) by checking the error message. - if err == context.Canceled || err.Error() == "operation was canceled" { - return true - } - - wrapper, ok := err.(interface{ Unwrap() error }) - if !ok { - break - } - err = wrapper.Unwrap() - } - - return false - } - - // Ignore errors that indicate a client-side timeout occurred when the context passed into an - // operation timed out or was canceled (i.e. errors caused by an operation-scoped timeout). - // Timeouts caused by reaching connectTimeoutMS or other non-operation-scoped timeouts should - // still clear the pool. - // TODO(GODRIVER-2038): Remove this condition when connections are no longer created with an - // operation-scoped timeout. - if isCtxTimeoutOrCanceled(opCtx) && isErrTimeoutOrCanceled(wrappedConnErr) { - return - } - // Since the only kind of ConnectionError we receive from pool.Get will be an initialization error, we should set // the description.Server appropriately. The description should not have a TopologyVersion because the staleness // checking logic above has already determined that this description is not stale. @@ -422,7 +366,7 @@ func getWriteConcernErrorForProcessing(err error) (*driver.WriteConcernError, bo } wcerr := writeCmdErr.WriteConcernError - if wcerr != nil && (wcerr.NodeIsRecovering() || wcerr.NotMaster()) { + if wcerr != nil && (wcerr.NodeIsRecovering() || wcerr.NotPrimary()) { return wcerr, true } return nil, false @@ -442,10 +386,10 @@ func (s *Server) ProcessError(err error, conn driver.Connection) driver.ProcessE if conn.Stale() { return driver.NoChange } - // Invalidate server description if not master or node recovering error occurs. + // Invalidate server description if not primary or node recovering error occurs. // These errors can be reported as a command error or a write concern error. desc := conn.Description() - if cerr, ok := err.(driver.Error); ok && (cerr.NodeIsRecovering() || cerr.NotMaster()) { + if cerr, ok := err.(driver.Error); ok && (cerr.NodeIsRecovering() || cerr.NotPrimary()) { // ignore stale error if desc.TopologyVersion.CompareToIncoming(cerr.TopologyVersion) >= 0 { return driver.NoChange @@ -651,8 +595,7 @@ func (s *Server) updateDescription(desc description.Server) { // createConnection creates a new connection instance but does not call connect on it. The caller must call connect // before the connection can be used for network operations. func (s *Server) createConnection() (*connection, error) { - opts := make([]ConnectionOption, len(s.cfg.connectionOpts)) - copy(opts, s.cfg.connectionOpts) + opts := copyConnectionOpts(s.cfg.connectionOpts) opts = append(opts, WithConnectTimeout(func(time.Duration) time.Duration { return s.cfg.heartbeatTimeout }), WithReadTimeout(func(time.Duration) time.Duration { return s.cfg.heartbeatTimeout }), @@ -660,17 +603,22 @@ func (s *Server) createConnection() (*connection, error) { // We override whatever handshaker is currently attached to the options with a basic // one because need to make sure we don't do auth. WithHandshaker(func(h Handshaker) Handshaker { - return operation.NewIsMaster().AppName(s.cfg.appname).Compressors(s.cfg.compressionOpts). + return operation.NewHello().AppName(s.cfg.appname).Compressors(s.cfg.compressionOpts). ServerAPI(s.cfg.serverAPI) }), // Override any monitors specified in options with nil to avoid monitoring heartbeats. WithMonitor(func(*event.CommandMonitor) *event.CommandMonitor { return nil }), - withPoolMonitor(func(*event.PoolMonitor) *event.PoolMonitor { return nil }), ) return newConnection(s.address, opts...) } +func copyConnectionOpts(opts []ConnectionOption) []ConnectionOption { + optsCopy := make([]ConnectionOption, len(opts)) + copy(optsCopy, opts) + return optsCopy +} + func (s *Server) setupHeartbeatConnection() error { conn, err := s.createConnection() if err != nil { @@ -719,9 +667,9 @@ func (s *Server) checkWasCancelled() bool { return s.heartbeatCtx.Err() != nil } -func (s *Server) createBaseOperation(conn driver.Connection) *operation.IsMaster { +func (s *Server) createBaseOperation(conn driver.Connection) *operation.Hello { return operation. - NewIsMaster(). + NewHello(). ClusterClock(s.cfg.clock). Deployment(driver.SingleConnectionDeployment{conn}). ServerAPI(s.cfg.serverAPI) @@ -739,9 +687,8 @@ func (s *Server) check() (description.Server, error) { err = s.setupHeartbeatConnection() if err == nil { // Use the description from the connection handshake as the value for this check. - s.rttMonitor.addSample(s.conn.isMasterRTT) + s.rttMonitor.addSample(s.conn.helloRTT) descPtr = &s.conn.desc - durationNanos = s.conn.isMasterRTT.Nanoseconds() } } @@ -762,7 +709,7 @@ func (s *Server) check() (description.Server, error) { err = baseOperation.StreamResponse(s.heartbeatCtx, heartbeatConn) case streamable: // The server supports the streamable protocol. Set the socket timeout to - // connectTimeoutMS+heartbeatFrequencyMS and execute an awaitable isMaster request. Set conn.canStream so + // connectTimeoutMS+heartbeatFrequencyMS and execute an awaitable hello request. Set conn.canStream so // the wire message will advertise streaming support to the server. // Calculation for maxAwaitTimeMS is taken from time.Duration.Milliseconds (added in Go 1.13). @@ -840,6 +787,11 @@ func extractTopologyVersion(err error) *description.TopologyVersion { return nil } +// MinRTT returns the minimum round-trip time to the server observed over the last 5 minutes. +func (s *Server) MinRTT() time.Duration { + return s.rttMonitor.getMinRTT() +} + // String implements the Stringer interface. func (s *Server) String() string { desc := s.Description() @@ -850,7 +802,7 @@ func (s *Server) String() string { str += fmt.Sprintf(", Tag sets: %s", desc.Tags) } if connState == connected { - str += fmt.Sprintf(", Average RTT: %d", desc.AverageRTT) + str += fmt.Sprintf(", Average RTT: %s, Min RTT: %s", desc.AverageRTT, s.MinRTT()) } if desc.LastError != nil { str += fmt.Sprintf(", Last error: %s", desc.LastError) @@ -889,17 +841,21 @@ func (ss *ServerSubscription) Unsubscribe() error { // publishes a ServerOpeningEvent to indicate the server is being initialized func (s *Server) publishServerOpeningEvent(addr address.Address) { + if s == nil { + return + } + serverOpening := &event.ServerOpeningEvent{ Address: addr, TopologyID: s.topologyID, } - if s != nil && s.cfg.serverMonitor != nil && s.cfg.serverMonitor.ServerOpening != nil { + if s.cfg.serverMonitor != nil && s.cfg.serverMonitor.ServerOpening != nil { s.cfg.serverMonitor.ServerOpening(serverOpening) } } -// publishes a ServerHeartbeatStartedEvent to indicate an ismaster command has started +// publishes a ServerHeartbeatStartedEvent to indicate a hello command has started func (s *Server) publishServerHeartbeatStartedEvent(connectionID string, await bool) { serverHeartbeatStarted := &event.ServerHeartbeatStartedEvent{ ConnectionID: connectionID, @@ -911,7 +867,7 @@ func (s *Server) publishServerHeartbeatStartedEvent(connectionID string, await b } } -// publishes a ServerHeartbeatSucceededEvent to indicate ismaster has succeeded +// publishes a ServerHeartbeatSucceededEvent to indicate hello has succeeded func (s *Server) publishServerHeartbeatSucceededEvent(connectionID string, durationNanos int64, desc description.Server, @@ -928,7 +884,7 @@ func (s *Server) publishServerHeartbeatSucceededEvent(connectionID string, } } -// publishes a ServerHeartbeatFailedEvent to indicate ismaster has failed +// publishes a ServerHeartbeatFailedEvent to indicate hello has failed func (s *Server) publishServerHeartbeatFailedEvent(connectionID string, durationNanos int64, err error, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go index 1b82f192..37258aaf 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/server_options.go @@ -27,6 +27,7 @@ type serverConfig struct { heartbeatTimeout time.Duration maxConns uint64 minConns uint64 + maxConnecting uint64 poolMonitor *event.PoolMonitor serverMonitor *event.ServerMonitor connectionPoolMaxIdleTime time.Duration @@ -124,6 +125,16 @@ func WithMinConnections(fn func(uint64) uint64) ServerOption { } } +// WithMaxConnecting configures the maximum number of connections a connection +// pool may establish simultaneously. If maxConnecting is 0, the default value +// of 2 is used. +func WithMaxConnecting(fn func(uint64) uint64) ServerOption { + return func(cfg *serverConfig) error { + cfg.maxConnecting = fn(cfg.maxConnecting) + return nil + } +} + // WithConnectionPoolMaxIdleTime configures the maximum time that a connection can remain idle in the connection pool // before being removed. If connectionPoolMaxIdleTime is 0, then no idle time is set and connections will not be removed // because of their age diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go index 24afb1da..0f3ccdfd 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go @@ -23,6 +23,7 @@ import ( "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/event" + "go.mongodb.org/mongo-driver/internal/randutil" "go.mongodb.org/mongo-driver/mongo/address" "go.mongodb.org/mongo-driver/mongo/description" "go.mongodb.org/mongo-driver/x/mongo/driver" @@ -48,6 +49,9 @@ var ErrServerSelectionTimeout = errors.New("server selection timeout") // MonitorMode represents the way in which a server is monitored. type MonitorMode uint8 +// random is a package-global pseudo-random number generator. +var random = randutil.NewLockedRand(rand.NewSource(time.Now().UnixNano())) + // These constants are the available monitoring modes. const ( AutomaticMode MonitorMode = iota @@ -395,7 +399,7 @@ func (t *Topology) SelectServer(ctx context.Context, ss description.ServerSelect continue } - selected := suitable[rand.Intn(len(suitable))] + selected := suitable[random.Intn(len(suitable))] selectedS, err := t.FindServer(selected) switch { case err != nil: @@ -527,7 +531,7 @@ func (t *Topology) pollSRVRecords() { break } - parsedHosts, err := t.dnsResolver.ParseHosts(hosts, false) + parsedHosts, err := t.dnsResolver.ParseHosts(hosts, t.cfg.srvServiceName, false) // DNS problem or no verified hosts returned if err != nil || len(parsedHosts) == 0 { if !t.pollHeartbeatTime.Load().(bool) { @@ -581,11 +585,25 @@ func (t *Topology) processSRVResults(parsedHosts []string) bool { t.fsm.removeServerByAddr(addr) t.publishServerClosedEvent(s.address) } + + // Now that we've removed all the hosts that disappeared from the SRV record, we need to add any + // new hosts added to the SRV record. If adding all of the new hosts would increase the number + // of servers past srvMaxHosts, shuffle the list of added hosts. + if t.cfg.srvMaxHosts > 0 && len(t.servers)+len(diff.Added) > t.cfg.srvMaxHosts { + random.Shuffle(len(diff.Added), func(i, j int) { + diff.Added[i], diff.Added[j] = diff.Added[j], diff.Added[i] + }) + } + // Add all added hosts until the number of servers reaches srvMaxHosts. for _, a := range diff.Added { + if t.cfg.srvMaxHosts > 0 && len(t.servers) >= t.cfg.srvMaxHosts { + break + } addr := address.Address(a).Canonicalize() _ = t.addServer(addr) t.fsm.addServer(addr) } + //store new description newDesc := description.Topology{ Kind: t.fsm.Kind, diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go index fa74764e..aca85b0b 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options.go @@ -36,6 +36,8 @@ type config struct { uri string serverSelectionTimeout time.Duration serverMonitor *event.ServerMonitor + srvMaxHosts int + srvServiceName string loadBalanced bool } @@ -198,7 +200,7 @@ func WithConnString(fn func(connstring.ConnString) connstring.ConnString) Option } else { // We need to add a non-auth Handshaker to the connection options connOpts = append(connOpts, WithHandshaker(func(h driver.Handshaker) driver.Handshaker { - return operation.NewIsMaster().AppName(cs.AppName).Compressors(cs.Compressors) + return operation.NewHello().AppName(cs.AppName).Compressors(cs.Compressors) })) } @@ -304,6 +306,30 @@ func WithURI(fn func(string) string) Option { } } +// WithLoadBalanced specifies whether or not the cluster is behind a load balancer. +func WithLoadBalanced(fn func(bool) bool) Option { + return func(cfg *config) error { + cfg.loadBalanced = fn(cfg.loadBalanced) + return nil + } +} + +// WithSRVMaxHosts specifies the SRV host limit that was used to create the topology. +func WithSRVMaxHosts(fn func(int) int) Option { + return func(cfg *config) error { + cfg.srvMaxHosts = fn(cfg.srvMaxHosts) + return nil + } +} + +// WithSRVServiceName specifies the SRV service name that was used to create the topology. +func WithSRVServiceName(fn func(string) string) Option { + return func(cfg *config) error { + cfg.srvServiceName = fn(cfg.srvServiceName) + return nil + } +} + // addCACertFromFile adds a root CA certificate to the configuration given a path // to the containing file. func addCACertFromFile(cfg *tls.Config, file string) error { @@ -335,7 +361,7 @@ func loadCert(data []byte) ([]byte, error) { var certBlock *pem.Block for certBlock == nil { - if data == nil || len(data) == 0 { + if len(data) == 0 { return nil, errors.New(".pem file must have both a CERTIFICATE and an RSA PRIVATE KEY section") } @@ -420,13 +446,5 @@ func addClientCertFromFile(cfg *tls.Config, clientFile, keyPasswd string) (strin return "", err } - return x509CertSubject(crt), nil -} - -// WithLoadBalanced specifies whether or not the cluster is behind a load balancer. -func WithLoadBalanced(fn func(bool) bool) Option { - return func(cfg *config) error { - cfg.loadBalanced = fn(cfg.loadBalanced) - return nil - } + return crt.Subject.String(), nil } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_10.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_10.go deleted file mode 100644 index 04c4b897..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_10.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build go1.10 - -package topology - -import "crypto/x509" - -func x509CertSubject(cert *x509.Certificate) string { - return cert.Subject.String() -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_9.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_9.go deleted file mode 100644 index b3ad273f..00000000 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology_options_1_9.go +++ /dev/null @@ -1,13 +0,0 @@ -// +build !go1.10 - -package topology - -import ( - "crypto/x509" -) - -// We don't support version less then 1.10, but Evergreen needs to be able to compile the driver -// using version 1.8. -func x509CertSubject(cert *x509.Certificate) string { - return "" -} diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/uuid/uuid.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/uuid/uuid.go index 83a67850..50d26344 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/uuid/uuid.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/uuid/uuid.go @@ -7,21 +7,27 @@ package uuid // import "go.mongodb.org/mongo-driver/x/mongo/driver/uuid" import ( - "bytes" - "crypto/rand" "io" + "math/rand" + "time" + + "go.mongodb.org/mongo-driver/internal/randutil" ) // UUID represents a UUID. type UUID [16]byte -var rander = rand.Reader +// random is a package-global pseudo-random number generator. +var random = randutil.NewLockedRand(rand.NewSource(time.Now().UnixNano())) -// New generates a new uuid. +// New returns a random UUIDv4. It uses a "math/rand" pseudo-random number generator seeded with the +// package initialization time. +// +// New should not be used to generate cryptographically-secure random UUIDs. func New() (UUID, error) { var uuid [16]byte - _, err := io.ReadFull(rander, uuid[:]) + _, err := io.ReadFull(random, uuid[:]) if err != nil { return [16]byte{}, err } @@ -33,5 +39,5 @@ func New() (UUID, error) { // Equal returns true if two UUIDs are equal. func Equal(a, b UUID) bool { - return bytes.Equal([]byte(a[:]), []byte(b[:])) + return a == b } diff --git a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage/wiremessage.go b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage/wiremessage.go index f00e47b9..abf9ad1c 100644 --- a/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage/wiremessage.go +++ b/backend/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage/wiremessage.go @@ -78,7 +78,7 @@ type QueryFlag int32 const ( _ QueryFlag = 1 << iota TailableCursor - SlaveOK + SecondaryOK OplogReplay NoCursorTimeout AwaitData @@ -92,8 +92,8 @@ func (qf QueryFlag) String() string { if qf&TailableCursor == TailableCursor { strs = append(strs, "TailableCursor") } - if qf&SlaveOK == SlaveOK { - strs = append(strs, "SlaveOK") + if qf&SecondaryOK == SecondaryOK { + strs = append(strs, "SecondaryOK") } if qf&OplogReplay == OplogReplay { strs = append(strs, "OplogReplay") diff --git a/backend/vendor/golang.org/x/crypto/acme/autocert/autocert.go b/backend/vendor/golang.org/x/crypto/acme/autocert/autocert.go index c7fbc54c..37923f43 100644 --- a/backend/vendor/golang.org/x/crypto/acme/autocert/autocert.go +++ b/backend/vendor/golang.org/x/crypto/acme/autocert/autocert.go @@ -1200,6 +1200,10 @@ func validCert(ck certKey, der [][]byte, key crypto.Signer, now time.Time) (leaf if err := leaf.VerifyHostname(ck.domain); err != nil { return nil, err } + // renew certificates revoked by Let's Encrypt in January 2022 + if isRevokedLetsEncrypt(leaf) { + return nil, errors.New("acme/autocert: certificate was probably revoked by Let's Encrypt") + } // ensure the leaf corresponds to the private key and matches the certKey type switch pub := leaf.PublicKey.(type) { case *rsa.PublicKey: @@ -1230,6 +1234,18 @@ func validCert(ck certKey, der [][]byte, key crypto.Signer, now time.Time) (leaf return leaf, nil } +// https://community.letsencrypt.org/t/2022-01-25-issue-with-tls-alpn-01-validation-method/170450 +var letsEncryptFixDeployTime = time.Date(2022, time.January, 26, 00, 48, 0, 0, time.UTC) + +// isRevokedLetsEncrypt returns whether the certificate is likely to be part of +// a batch of certificates revoked by Let's Encrypt in January 2022. This check +// can be safely removed from May 2022. +func isRevokedLetsEncrypt(cert *x509.Certificate) bool { + O := cert.Issuer.Organization + return len(O) == 1 && O[0] == "Let's Encrypt" && + cert.NotBefore.Before(letsEncryptFixDeployTime) +} + type lockedMathRand struct { sync.Mutex rnd *mathrand.Rand diff --git a/backend/vendor/golang.org/x/sync/semaphore/semaphore.go b/backend/vendor/golang.org/x/sync/semaphore/semaphore.go deleted file mode 100644 index 30f632c5..00000000 --- a/backend/vendor/golang.org/x/sync/semaphore/semaphore.go +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package semaphore provides a weighted semaphore implementation. -package semaphore // import "golang.org/x/sync/semaphore" - -import ( - "container/list" - "context" - "sync" -) - -type waiter struct { - n int64 - ready chan<- struct{} // Closed when semaphore acquired. -} - -// NewWeighted creates a new weighted semaphore with the given -// maximum combined weight for concurrent access. -func NewWeighted(n int64) *Weighted { - w := &Weighted{size: n} - return w -} - -// Weighted provides a way to bound concurrent access to a resource. -// The callers can request access with a given weight. -type Weighted struct { - size int64 - cur int64 - mu sync.Mutex - waiters list.List -} - -// Acquire acquires the semaphore with a weight of n, blocking until resources -// are available or ctx is done. On success, returns nil. On failure, returns -// ctx.Err() and leaves the semaphore unchanged. -// -// If ctx is already done, Acquire may still succeed without blocking. -func (s *Weighted) Acquire(ctx context.Context, n int64) error { - s.mu.Lock() - if s.size-s.cur >= n && s.waiters.Len() == 0 { - s.cur += n - s.mu.Unlock() - return nil - } - - if n > s.size { - // Don't make other Acquire calls block on one that's doomed to fail. - s.mu.Unlock() - <-ctx.Done() - return ctx.Err() - } - - ready := make(chan struct{}) - w := waiter{n: n, ready: ready} - elem := s.waiters.PushBack(w) - s.mu.Unlock() - - select { - case <-ctx.Done(): - err := ctx.Err() - s.mu.Lock() - select { - case <-ready: - // Acquired the semaphore after we were canceled. Rather than trying to - // fix up the queue, just pretend we didn't notice the cancelation. - err = nil - default: - isFront := s.waiters.Front() == elem - s.waiters.Remove(elem) - // If we're at the front and there're extra tokens left, notify other waiters. - if isFront && s.size > s.cur { - s.notifyWaiters() - } - } - s.mu.Unlock() - return err - - case <-ready: - return nil - } -} - -// TryAcquire acquires the semaphore with a weight of n without blocking. -// On success, returns true. On failure, returns false and leaves the semaphore unchanged. -func (s *Weighted) TryAcquire(n int64) bool { - s.mu.Lock() - success := s.size-s.cur >= n && s.waiters.Len() == 0 - if success { - s.cur += n - } - s.mu.Unlock() - return success -} - -// Release releases the semaphore with a weight of n. -func (s *Weighted) Release(n int64) { - s.mu.Lock() - s.cur -= n - if s.cur < 0 { - s.mu.Unlock() - panic("semaphore: released more than held") - } - s.notifyWaiters() - s.mu.Unlock() -} - -func (s *Weighted) notifyWaiters() { - for { - next := s.waiters.Front() - if next == nil { - break // No more waiters blocked. - } - - w := next.Value.(waiter) - if s.size-s.cur < w.n { - // Not enough tokens for the next waiter. We could keep going (to try to - // find a waiter with a smaller request), but under load that could cause - // starvation for large requests; instead, we leave all remaining waiters - // blocked. - // - // Consider a semaphore used as a read-write lock, with N tokens, N - // readers, and one writer. Each reader can Acquire(1) to obtain a read - // lock. The writer can Acquire(N) to obtain a write lock, excluding all - // of the readers. If we allow the readers to jump ahead in the queue, - // the writer will starve — there is always one token available for every - // reader. - break - } - - s.cur += w.n - s.waiters.Remove(next) - close(w.ready) - } -} diff --git a/backend/vendor/golang.org/x/sys/unix/README.md b/backend/vendor/golang.org/x/sys/unix/README.md index 474efad0..7d3c060e 100644 --- a/backend/vendor/golang.org/x/sys/unix/README.md +++ b/backend/vendor/golang.org/x/sys/unix/README.md @@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable. Then, edit the regex (if necessary) to match the desired constant. Avoid making the regex too broad to avoid matching unintended constants. -### mkmerge.go +### internal/mkmerge This program is used to extract duplicate const, func, and type declarations from the generated architecture-specific files listed below, and merge these diff --git a/backend/vendor/golang.org/x/sys/unix/mkall.sh b/backend/vendor/golang.org/x/sys/unix/mkall.sh index 396aadf8..ee736234 100644 --- a/backend/vendor/golang.org/x/sys/unix/mkall.sh +++ b/backend/vendor/golang.org/x/sys/unix/mkall.sh @@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then # Use the Docker-based build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) $cmd docker build --tag generate:$GOOS $GOOS - $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS + $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS exit fi diff --git a/backend/vendor/golang.org/x/sys/unix/mkerrors.sh b/backend/vendor/golang.org/x/sys/unix/mkerrors.sh index a74ef58f..a47b035f 100644 --- a/backend/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/backend/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -239,6 +239,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -260,6 +261,7 @@ struct ltchars { #include #include #include +#include #include #include @@ -520,7 +522,7 @@ ccflags="$@" $2 ~ /^HW_MACHINE$/ || $2 ~ /^SYSCTL_VERS/ || $2 !~ "MNT_BITS" && - $2 ~ /^(MS|MNT|UMOUNT)_/ || + $2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ || $2 ~ /^NS_GET_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || $2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ || @@ -605,6 +607,7 @@ ccflags="$@" $2 ~ /^MTD/ || $2 ~ /^OTP/ || $2 ~ /^MEM/ || + $2 ~ /^WG/ || $2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)} diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_aix.go b/backend/vendor/golang.org/x/sys/unix/syscall_aix.go index 680c954b..4f55c8d9 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_aix.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_aix.go @@ -377,6 +377,11 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys fcntl(fd int, cmd int, arg int) (val int, err error) +//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range +func Fsync(fd int) error { + return fsyncRange(fd, O_SYNC, 0, 0) +} + /* * Direct access */ @@ -393,7 +398,6 @@ func (w WaitStatus) TrapCause() int { return -1 } //sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) //sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error) //sys Fdatasync(fd int) (err error) -//sys Fsync(fd int) (err error) // readdir_r //sysnb Getpgid(pid int) (pgid int, err error) @@ -515,8 +519,10 @@ func Pipe(p []int) (err error) { } var pp [2]_C_int err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_darwin.go b/backend/vendor/golang.org/x/sys/unix/syscall_darwin.go index 8826f414..0eaab913 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -159,8 +159,10 @@ func Pipe(p []int) (err error) { } var x [2]int32 err = pipe(&x) - p[0] = int(x[0]) - p[1] = int(x[1]) + if err == nil { + p[0] = int(x[0]) + p[1] = int(x[1]) + } return } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/backend/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 5af108a5..2e37c316 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -101,7 +101,10 @@ func Pipe(p []int) (err error) { if len(p) != 2 { return EINVAL } - p[0], p[1], err = pipe() + r, w, err := pipe() + if err == nil { + p[0], p[1] = r, w + } return } @@ -114,7 +117,10 @@ func Pipe2(p []int, flags int) (err error) { var pp [2]_C_int // pipe2 on dragonfly takes an fds array as an argument, but still // returns the file descriptors. - p[0], p[1], err = pipe2(&pp, flags) + r, w, err := pipe2(&pp, flags) + if err == nil { + p[0], p[1] = r, w + } return err } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/backend/vendor/golang.org/x/sys/unix/syscall_freebsd.go index 18c392cf..2f650ae6 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -110,8 +110,10 @@ func Pipe2(p []int, flags int) error { } var pp [2]_C_int err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return err } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_linux.go b/backend/vendor/golang.org/x/sys/unix/syscall_linux.go index bc9dc2e1..f432b068 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -131,8 +131,10 @@ func Pipe2(p []int, flags int) error { } var pp [2]_C_int err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return err } @@ -1775,6 +1777,16 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri return mount(source, target, fstype, flags, datap) } +//sys mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) = SYS_MOUNT_SETATTR + +// MountSetattr is a wrapper for mount_setattr(2). +// https://man7.org/linux/man-pages/man2/mount_setattr.2.html +// +// Requires kernel >= 5.12. +func MountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr) error { + return mountSetattr(dirfd, pathname, flags, attr, unsafe.Sizeof(*attr)) +} + func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { if raceenabled { raceReleaseMerge(unsafe.Pointer(&ioSync)) diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/backend/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 853d5f0f..696fed49 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -110,14 +110,8 @@ func direntNamlen(buf []byte) (uint64, bool) { return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) } -//sysnb pipe() (fd1 int, fd2 int, err error) - func Pipe(p []int) (err error) { - if len(p) != 2 { - return EINVAL - } - p[0], p[1], err = pipe() - return + return Pipe2(p, 0) } //sysnb pipe2(p *[2]_C_int, flags int) (err error) @@ -128,8 +122,10 @@ func Pipe2(p []int, flags int) error { } var pp [2]_C_int err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return err } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/backend/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 22b55038..11b1d419 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -87,8 +87,10 @@ func Pipe2(p []int, flags int) error { } var pp [2]_C_int err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return err } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_solaris.go b/backend/vendor/golang.org/x/sys/unix/syscall_solaris.go index 8b88ac21..5c813921 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -66,8 +66,10 @@ func Pipe(p []int) (err error) { if n != 0 { return err } - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return nil } @@ -79,8 +81,10 @@ func Pipe2(p []int, flags int) error { } var pp [2]_C_int err := pipe2(&pp, flags) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return err } diff --git a/backend/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go b/backend/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go index 5fb76a14..f8616f45 100644 --- a/backend/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go +++ b/backend/vendor/golang.org/x/sys/unix/syscall_zos_s390x.go @@ -579,8 +579,10 @@ func Pipe(p []int) (err error) { } var pp [2]_C_int err = pipe(&pp) - p[0] = int(pp[0]) - p[1] = int(pp[1]) + if err == nil { + p[0] = int(pp[0]) + p[1] = int(pp[1]) + } return } diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux.go index 3bbc5275..4e542058 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -741,6 +741,7 @@ const ( ETH_P_QINQ2 = 0x9200 ETH_P_QINQ3 = 0x9300 ETH_P_RARP = 0x8035 + ETH_P_REALTEK = 0x8899 ETH_P_SCA = 0x6007 ETH_P_SLOW = 0x8809 ETH_P_SNAP = 0x5 @@ -810,10 +811,12 @@ const ( FAN_EPIDFD = -0x2 FAN_EVENT_INFO_TYPE_DFID = 0x3 FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 + FAN_EVENT_INFO_TYPE_ERROR = 0x5 FAN_EVENT_INFO_TYPE_FID = 0x1 FAN_EVENT_INFO_TYPE_PIDFD = 0x4 FAN_EVENT_METADATA_LEN = 0x18 FAN_EVENT_ON_CHILD = 0x8000000 + FAN_FS_ERROR = 0x8000 FAN_MARK_ADD = 0x1 FAN_MARK_DONT_FOLLOW = 0x4 FAN_MARK_FILESYSTEM = 0x100 @@ -1476,6 +1479,18 @@ const ( MNT_FORCE = 0x1 MODULE_INIT_IGNORE_MODVERSIONS = 0x1 MODULE_INIT_IGNORE_VERMAGIC = 0x2 + MOUNT_ATTR_IDMAP = 0x100000 + MOUNT_ATTR_NOATIME = 0x10 + MOUNT_ATTR_NODEV = 0x4 + MOUNT_ATTR_NODIRATIME = 0x80 + MOUNT_ATTR_NOEXEC = 0x8 + MOUNT_ATTR_NOSUID = 0x2 + MOUNT_ATTR_NOSYMFOLLOW = 0x200000 + MOUNT_ATTR_RDONLY = 0x1 + MOUNT_ATTR_RELATIME = 0x0 + MOUNT_ATTR_SIZE_VER0 = 0x20 + MOUNT_ATTR_STRICTATIME = 0x20 + MOUNT_ATTR__ATIME = 0x70 MSDOS_SUPER_MAGIC = 0x4d44 MSG_BATCH = 0x40000 MSG_CMSG_CLOEXEC = 0x40000000 @@ -1815,6 +1830,8 @@ const ( PERF_MEM_BLK_DATA = 0x2 PERF_MEM_BLK_NA = 0x1 PERF_MEM_BLK_SHIFT = 0x28 + PERF_MEM_HOPS_0 = 0x1 + PERF_MEM_HOPS_SHIFT = 0x2b PERF_MEM_LOCK_LOCKED = 0x2 PERF_MEM_LOCK_NA = 0x1 PERF_MEM_LOCK_SHIFT = 0x18 @@ -1974,6 +1991,9 @@ const ( PR_SCHED_CORE_CREATE = 0x1 PR_SCHED_CORE_GET = 0x0 PR_SCHED_CORE_MAX = 0x4 + PR_SCHED_CORE_SCOPE_PROCESS_GROUP = 0x2 + PR_SCHED_CORE_SCOPE_THREAD = 0x0 + PR_SCHED_CORE_SCOPE_THREAD_GROUP = 0x1 PR_SCHED_CORE_SHARE_FROM = 0x3 PR_SCHED_CORE_SHARE_TO = 0x2 PR_SET_CHILD_SUBREAPER = 0x24 @@ -2155,12 +2175,23 @@ const ( RTCF_NAT = 0x800000 RTCF_VALVE = 0x200000 RTC_AF = 0x20 + RTC_BSM_DIRECT = 0x1 + RTC_BSM_DISABLED = 0x0 + RTC_BSM_LEVEL = 0x2 + RTC_BSM_STANDBY = 0x3 RTC_FEATURE_ALARM = 0x0 + RTC_FEATURE_ALARM_RES_2S = 0x3 RTC_FEATURE_ALARM_RES_MINUTE = 0x1 - RTC_FEATURE_CNT = 0x3 + RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6 + RTC_FEATURE_CNT = 0x7 + RTC_FEATURE_CORRECTION = 0x5 RTC_FEATURE_NEED_WEEK_DAY = 0x2 + RTC_FEATURE_UPDATE_INTERRUPT = 0x4 RTC_IRQF = 0x80 RTC_MAX_FREQ = 0x2000 + RTC_PARAM_BACKUP_SWITCH_MODE = 0x2 + RTC_PARAM_CORRECTION = 0x1 + RTC_PARAM_FEATURES = 0x0 RTC_PF = 0x40 RTC_UF = 0x10 RTF_ADDRCLASSMASK = 0xf8000000 @@ -2520,6 +2551,8 @@ const ( SO_VM_SOCKETS_BUFFER_MIN_SIZE = 0x1 SO_VM_SOCKETS_BUFFER_SIZE = 0x0 SO_VM_SOCKETS_CONNECT_TIMEOUT = 0x6 + SO_VM_SOCKETS_CONNECT_TIMEOUT_NEW = 0x8 + SO_VM_SOCKETS_CONNECT_TIMEOUT_OLD = 0x6 SO_VM_SOCKETS_NONBLOCK_TXRX = 0x7 SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 @@ -2814,6 +2847,13 @@ const ( WDIOS_TEMPPANIC = 0x4 WDIOS_UNKNOWN = -0x1 WEXITED = 0x4 + WGALLOWEDIP_A_MAX = 0x3 + WGDEVICE_A_MAX = 0x8 + WGPEER_A_MAX = 0xa + WG_CMD_MAX = 0x1 + WG_GENL_NAME = "wireguard" + WG_GENL_VERSION = 0x1 + WG_KEY_LEN = 0x20 WIN_ACKMEDIACHANGE = 0xdb WIN_CHECKPOWERMODE1 = 0xe5 WIN_CHECKPOWERMODE2 = 0x98 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 80c79084..234fd4a5 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -5,7 +5,7 @@ // +build 386,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/_const.go package unix @@ -250,6 +250,8 @@ const ( RTC_EPOCH_SET = 0x4004700e RTC_IRQP_READ = 0x8004700b RTC_IRQP_SET = 0x4004700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x801c7011 @@ -327,6 +329,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index da55638a..58619b75 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -5,7 +5,7 @@ // +build amd64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/_const.go package unix @@ -251,6 +251,8 @@ const ( RTC_EPOCH_SET = 0x4008700e RTC_IRQP_READ = 0x8008700b RTC_IRQP_SET = 0x4008700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x80207011 @@ -328,6 +330,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index c3da063c..3a64ff59 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -5,7 +5,7 @@ // +build arm,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -257,6 +257,8 @@ const ( RTC_EPOCH_SET = 0x4004700e RTC_IRQP_READ = 0x8004700b RTC_IRQP_SET = 0x4004700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x801c7011 @@ -334,6 +336,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index fd9f0d1d..abe0b925 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -5,7 +5,7 @@ // +build arm64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go package unix @@ -247,6 +247,8 @@ const ( RTC_EPOCH_SET = 0x4008700e RTC_IRQP_READ = 0x8008700b RTC_IRQP_SET = 0x4008700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x80207011 @@ -324,6 +326,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index c358ada0..14d7a843 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -5,7 +5,7 @@ // +build mips,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -250,6 +250,8 @@ const ( RTC_EPOCH_SET = 0x8004700e RTC_IRQP_READ = 0x4004700b RTC_IRQP_SET = 0x8004700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x401c7011 @@ -327,6 +329,7 @@ const ( SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 1dc1ee16..99e7c4ac 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -5,7 +5,7 @@ // +build mips64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -250,6 +250,8 @@ const ( RTC_EPOCH_SET = 0x8008700e RTC_IRQP_READ = 0x4008700b RTC_IRQP_SET = 0x8008700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x40207011 @@ -327,6 +329,7 @@ const ( SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 3ae187dd..496364c3 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -5,7 +5,7 @@ // +build mips64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -250,6 +250,8 @@ const ( RTC_EPOCH_SET = 0x8008700e RTC_IRQP_READ = 0x4008700b RTC_IRQP_SET = 0x8008700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x40207011 @@ -327,6 +329,7 @@ const ( SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 39895f0d..3e408308 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -5,7 +5,7 @@ // +build mipsle,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -250,6 +250,8 @@ const ( RTC_EPOCH_SET = 0x8004700e RTC_IRQP_READ = 0x4004700b RTC_IRQP_SET = 0x8004700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x401c7011 @@ -327,6 +329,7 @@ const ( SO_RCVTIMEO = 0x1006 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x1006 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index a98a4553..1151a7df 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -5,7 +5,7 @@ // +build ppc,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -305,6 +305,8 @@ const ( RTC_EPOCH_SET = 0x8004700e RTC_IRQP_READ = 0x4004700b RTC_IRQP_SET = 0x8004700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x401c7011 @@ -382,6 +384,7 @@ const ( SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 0a8fbbff..ed17f249 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -5,7 +5,7 @@ // +build ppc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -309,6 +309,8 @@ const ( RTC_EPOCH_SET = 0x8008700e RTC_IRQP_READ = 0x4008700b RTC_IRQP_SET = 0x8008700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x40207011 @@ -386,6 +388,7 @@ const ( SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index cb835a14..d84a37c1 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -5,7 +5,7 @@ // +build ppc64le,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -309,6 +309,8 @@ const ( RTC_EPOCH_SET = 0x8008700e RTC_IRQP_READ = 0x4008700b RTC_IRQP_SET = 0x8008700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x40207011 @@ -386,6 +388,7 @@ const ( SO_RCVTIMEO = 0x12 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x12 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 73cf6554..5cafba83 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -5,7 +5,7 @@ // +build riscv64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -238,6 +238,8 @@ const ( RTC_EPOCH_SET = 0x4008700e RTC_IRQP_READ = 0x8008700b RTC_IRQP_SET = 0x4008700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x80207011 @@ -315,6 +317,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index 04b6dfaf..6d122da4 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -5,7 +5,7 @@ // +build s390x,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go package unix @@ -313,6 +313,8 @@ const ( RTC_EPOCH_SET = 0x4008700e RTC_IRQP_READ = 0x8008700b RTC_IRQP_SET = 0x4008700c + RTC_PARAM_GET = 0x40187013 + RTC_PARAM_SET = 0x40187014 RTC_PIE_OFF = 0x7006 RTC_PIE_ON = 0x7005 RTC_PLL_GET = 0x80207011 @@ -390,6 +392,7 @@ const ( SO_RCVTIMEO = 0x14 SO_RCVTIMEO_NEW = 0x42 SO_RCVTIMEO_OLD = 0x14 + SO_RESERVE_MEM = 0x49 SO_REUSEADDR = 0x2 SO_REUSEPORT = 0xf SO_RXQ_OVFL = 0x28 diff --git a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index 8c87d979..6bd19e51 100644 --- a/backend/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/backend/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -5,7 +5,7 @@ // +build sparc64,linux // Code generated by cmd/cgo -godefs; DO NOT EDIT. -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/_const.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go package unix @@ -304,6 +304,8 @@ const ( RTC_EPOCH_SET = 0x8008700e RTC_IRQP_READ = 0x4008700b RTC_IRQP_SET = 0x8008700c + RTC_PARAM_GET = 0x80187013 + RTC_PARAM_SET = 0x80187014 RTC_PIE_OFF = 0x20007006 RTC_PIE_ON = 0x20007005 RTC_PLL_GET = 0x40207011 @@ -381,6 +383,7 @@ const ( SO_RCVTIMEO = 0x2000 SO_RCVTIMEO_NEW = 0x44 SO_RCVTIMEO_OLD = 0x2000 + SO_RESERVE_MEM = 0x52 SO_REUSEADDR = 0x4 SO_REUSEPORT = 0x200 SO_RXQ_OVFL = 0x24 diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go index 91a23cc7..85e0cc38 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go @@ -17,6 +17,7 @@ int getdirent(int, uintptr_t, size_t); int wait4(int, uintptr_t, int, uintptr_t); int ioctl(int, int, uintptr_t); int fcntl(uintptr_t, int, uintptr_t); +int fsync_range(int, int, long long, long long); int acct(uintptr_t); int chdir(uintptr_t); int chroot(uintptr_t); @@ -29,7 +30,6 @@ int fchmod(int, unsigned int); int fchmodat(int, uintptr_t, unsigned int, int); int fchownat(int, uintptr_t, int, int, int); int fdatasync(int); -int fsync(int); int getpgid(int); int getpgrp(); int getpid(); @@ -255,6 +255,16 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fsyncRange(fd int, how int, start int64, length int64) (err error) { + r0, er := C.fsync_range(C.int(fd), C.int(how), C.longlong(start), C.longlong(length)) + if r0 == -1 && er != nil { + err = er + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { _p0 := uintptr(unsafe.Pointer(C.CString(path))) r0, er := C.acct(C.uintptr_t(_p0)) @@ -379,16 +389,6 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - r0, er := C.fsync(C.int(fd)) - if r0 == -1 && er != nil { - err = er - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, er := C.getpgid(C.int(pid)) pgid = int(r0) diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go index 33c2609b..f1d4a73b 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go @@ -135,6 +135,16 @@ func fcntl(fd int, cmd int, arg int) (val int, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func fsyncRange(fd int, how int, start int64, length int64) (err error) { + _, e1 := callfsync_range(fd, how, start, length) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) @@ -283,16 +293,6 @@ func Fdatasync(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Fsync(fd int) (err error) { - _, e1 := callfsync(fd) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func Getpgid(pid int) (pgid int, err error) { r0, e1 := callgetpgid(pid) pgid = int(r0) diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go index 8b737fa9..2caa5adf 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go @@ -18,6 +18,7 @@ import ( //go:cgo_import_dynamic libc_wait4 wait4 "libc.a/shr_64.o" //go:cgo_import_dynamic libc_ioctl ioctl "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fcntl fcntl "libc.a/shr_64.o" +//go:cgo_import_dynamic libc_fsync_range fsync_range "libc.a/shr_64.o" //go:cgo_import_dynamic libc_acct acct "libc.a/shr_64.o" //go:cgo_import_dynamic libc_chdir chdir "libc.a/shr_64.o" //go:cgo_import_dynamic libc_chroot chroot "libc.a/shr_64.o" @@ -30,7 +31,6 @@ import ( //go:cgo_import_dynamic libc_fchmodat fchmodat "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fchownat fchownat "libc.a/shr_64.o" //go:cgo_import_dynamic libc_fdatasync fdatasync "libc.a/shr_64.o" -//go:cgo_import_dynamic libc_fsync fsync "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpgid getpgid "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpgrp getpgrp "libc.a/shr_64.o" //go:cgo_import_dynamic libc_getpid getpid "libc.a/shr_64.o" @@ -136,6 +136,7 @@ import ( //go:linkname libc_wait4 libc_wait4 //go:linkname libc_ioctl libc_ioctl //go:linkname libc_fcntl libc_fcntl +//go:linkname libc_fsync_range libc_fsync_range //go:linkname libc_acct libc_acct //go:linkname libc_chdir libc_chdir //go:linkname libc_chroot libc_chroot @@ -148,7 +149,6 @@ import ( //go:linkname libc_fchmodat libc_fchmodat //go:linkname libc_fchownat libc_fchownat //go:linkname libc_fdatasync libc_fdatasync -//go:linkname libc_fsync libc_fsync //go:linkname libc_getpgid libc_getpgid //go:linkname libc_getpgrp libc_getpgrp //go:linkname libc_getpid libc_getpid @@ -257,6 +257,7 @@ var ( libc_wait4, libc_ioctl, libc_fcntl, + libc_fsync_range, libc_acct, libc_chdir, libc_chroot, @@ -269,7 +270,6 @@ var ( libc_fchmodat, libc_fchownat, libc_fdatasync, - libc_fsync, libc_getpgid, libc_getpgrp, libc_getpid, @@ -430,6 +430,13 @@ func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callfsync_range(fd int, how int, start int64, length int64) (r1 uintptr, e1 Errno) { + r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fsync_range)), 4, uintptr(fd), uintptr(how), uintptr(start), uintptr(length), 0, 0) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_acct)), 1, _p0, 0, 0, 0, 0, 0) return @@ -514,13 +521,6 @@ func callfdatasync(fd int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fsync)), 1, uintptr(fd), 0, 0, 0, 0, 0) - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func callgetpgid(pid int) (r1 uintptr, e1 Errno) { r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_getpgid)), 1, uintptr(pid), 0, 0, 0, 0, 0) return diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go index 3c260917..944a714b 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go @@ -16,6 +16,7 @@ int getdirent(int, uintptr_t, size_t); int wait4(int, uintptr_t, int, uintptr_t); int ioctl(int, int, uintptr_t); int fcntl(uintptr_t, int, uintptr_t); +int fsync_range(int, int, long long, long long); int acct(uintptr_t); int chdir(uintptr_t); int chroot(uintptr_t); @@ -28,7 +29,6 @@ int fchmod(int, unsigned int); int fchmodat(int, uintptr_t, unsigned int, int); int fchownat(int, uintptr_t, int, int, int); int fdatasync(int); -int fsync(int); int getpgid(int); int getpgrp(); int getpid(); @@ -199,6 +199,14 @@ func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func callfsync_range(fd int, how int, start int64, length int64) (r1 uintptr, e1 Errno) { + r1 = uintptr(C.fsync_range(C.int(fd), C.int(how), C.longlong(start), C.longlong(length))) + e1 = syscall.GetErrno() + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func callacct(_p0 uintptr) (r1 uintptr, e1 Errno) { r1 = uintptr(C.acct(C.uintptr_t(_p0))) e1 = syscall.GetErrno() @@ -295,14 +303,6 @@ func callfdatasync(fd int) (r1 uintptr, e1 Errno) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func callfsync(fd int) (r1 uintptr, e1 Errno) { - r1 = uintptr(C.fsync(C.int(fd))) - e1 = syscall.GetErrno() - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func callgetpgid(pid int) (r1 uintptr, e1 Errno) { r1 = uintptr(C.getpgid(C.int(pid))) e1 = syscall.GetErrno() diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 4f5da1f5..93edda4c 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -409,6 +409,21 @@ func mount(source string, target string, fstype string, flags uintptr, data *byt // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(pathname) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_MOUNT_SETATTR, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(unsafe.Pointer(attr)), uintptr(size), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Acct(path string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go index 4726ab30..51d0c074 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go @@ -351,18 +351,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (fd1 int, fd2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - fd1 = int(r0) - fd2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go index fe71456d..df2efb6d 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go @@ -351,18 +351,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (fd1 int, fd2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - fd1 = int(r0) - fd2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go index 0b5b2f01..c8536c2c 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go @@ -351,18 +351,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (fd1 int, fd2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - fd1 = int(r0) - fd2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go index bfca2864..8b981bfc 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go @@ -351,18 +351,6 @@ func Munlockall() (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func pipe() (fd1 int, fd2 int, err error) { - r0, r1, e1 := RawSyscall(SYS_PIPE, 0, 0, 0) - fd1 = int(r0) - fd2 = int(r1) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index 31847d23..cac1f758 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -445,4 +445,5 @@ const ( SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 3503cbbd..f327e4a0 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -367,4 +367,5 @@ const ( SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index 5ecd24bf..fb06a08d 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -409,4 +409,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 7e5c94cc..58285646 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -312,4 +312,5 @@ const ( SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_MEMFD_SECRET = 447 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index e1e2a2bf..3b0418e6 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -429,4 +429,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 4445 SYS_LANDLOCK_RESTRICT_SELF = 4446 SYS_PROCESS_MRELEASE = 4448 + SYS_FUTEX_WAITV = 4449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 7651915a..314ebf16 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -359,4 +359,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 5445 SYS_LANDLOCK_RESTRICT_SELF = 5446 SYS_PROCESS_MRELEASE = 5448 + SYS_FUTEX_WAITV = 5449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index a26a2c05..b8fbb937 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -359,4 +359,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 5445 SYS_LANDLOCK_RESTRICT_SELF = 5446 SYS_PROCESS_MRELEASE = 5448 + SYS_FUTEX_WAITV = 5449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index fda9a6a9..ee309b2b 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -429,4 +429,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 4445 SYS_LANDLOCK_RESTRICT_SELF = 4446 SYS_PROCESS_MRELEASE = 4448 + SYS_FUTEX_WAITV = 4449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index e8496150..ac374810 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -436,4 +436,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index 5ee0678a..5aa47211 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -408,4 +408,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 29c0f9a3..0793ac1a 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -408,4 +408,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 5c9a9a3b..a520962e 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -310,4 +310,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 913f50f9..d1738586 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -373,4 +373,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 0de03a72..dfd5660f 100644 --- a/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/backend/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -387,4 +387,5 @@ const ( SYS_LANDLOCK_ADD_RULE = 445 SYS_LANDLOCK_RESTRICT_SELF = 446 SYS_PROCESS_MRELEASE = 448 + SYS_FUTEX_WAITV = 449 ) diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux.go index 620a6702..66788f15 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -1,4 +1,4 @@ -// Code generated by mkmerge.go; DO NOT EDIT. +// Code generated by mkmerge; DO NOT EDIT. //go:build linux // +build linux @@ -743,6 +743,8 @@ const ( AT_STATX_FORCE_SYNC = 0x2000 AT_STATX_DONT_SYNC = 0x4000 + AT_RECURSIVE = 0x8000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 @@ -865,6 +867,7 @@ const ( CTRL_CMD_NEWMCAST_GRP = 0x7 CTRL_CMD_DELMCAST_GRP = 0x8 CTRL_CMD_GETMCAST_GRP = 0x9 + CTRL_CMD_GETPOLICY = 0xa CTRL_ATTR_UNSPEC = 0x0 CTRL_ATTR_FAMILY_ID = 0x1 CTRL_ATTR_FAMILY_NAME = 0x2 @@ -873,12 +876,19 @@ const ( CTRL_ATTR_MAXATTR = 0x5 CTRL_ATTR_OPS = 0x6 CTRL_ATTR_MCAST_GROUPS = 0x7 + CTRL_ATTR_POLICY = 0x8 + CTRL_ATTR_OP_POLICY = 0x9 + CTRL_ATTR_OP = 0xa CTRL_ATTR_OP_UNSPEC = 0x0 CTRL_ATTR_OP_ID = 0x1 CTRL_ATTR_OP_FLAGS = 0x2 CTRL_ATTR_MCAST_GRP_UNSPEC = 0x0 CTRL_ATTR_MCAST_GRP_NAME = 0x1 CTRL_ATTR_MCAST_GRP_ID = 0x2 + CTRL_ATTR_POLICY_UNSPEC = 0x0 + CTRL_ATTR_POLICY_DO = 0x1 + CTRL_ATTR_POLICY_DUMP = 0x2 + CTRL_ATTR_POLICY_DUMP_MAX = 0x2 ) const ( @@ -1134,7 +1144,8 @@ const ( PERF_RECORD_BPF_EVENT = 0x12 PERF_RECORD_CGROUP = 0x13 PERF_RECORD_TEXT_POKE = 0x14 - PERF_RECORD_MAX = 0x15 + PERF_RECORD_AUX_OUTPUT_HW_ID = 0x15 + PERF_RECORD_MAX = 0x16 PERF_RECORD_KSYMBOL_TYPE_UNKNOWN = 0x0 PERF_RECORD_KSYMBOL_TYPE_BPF = 0x1 PERF_RECORD_KSYMBOL_TYPE_OOL = 0x2 @@ -1774,7 +1785,8 @@ const ( const ( NF_NETDEV_INGRESS = 0x0 - NF_NETDEV_NUMHOOKS = 0x1 + NF_NETDEV_EGRESS = 0x1 + NF_NETDEV_NUMHOOKS = 0x2 ) const ( @@ -3156,7 +3168,13 @@ const ( DEVLINK_ATTR_RELOAD_ACTION_INFO = 0xa2 DEVLINK_ATTR_RELOAD_ACTION_STATS = 0xa3 DEVLINK_ATTR_PORT_PCI_SF_NUMBER = 0xa4 - DEVLINK_ATTR_MAX = 0xa9 + DEVLINK_ATTR_RATE_TYPE = 0xa5 + DEVLINK_ATTR_RATE_TX_SHARE = 0xa6 + DEVLINK_ATTR_RATE_TX_MAX = 0xa7 + DEVLINK_ATTR_RATE_NODE_NAME = 0xa8 + DEVLINK_ATTR_RATE_PARENT_NODE_NAME = 0xa9 + DEVLINK_ATTR_REGION_MAX_SNAPSHOTS = 0xaa + DEVLINK_ATTR_MAX = 0xaa DEVLINK_DPIPE_FIELD_MAPPING_TYPE_NONE = 0x0 DEVLINK_DPIPE_FIELD_MAPPING_TYPE_IFINDEX = 0x1 DEVLINK_DPIPE_MATCH_TYPE_FIELD_EXACT = 0x0 @@ -3453,7 +3471,14 @@ const ( ETHTOOL_MSG_CABLE_TEST_ACT = 0x1a ETHTOOL_MSG_CABLE_TEST_TDR_ACT = 0x1b ETHTOOL_MSG_TUNNEL_INFO_GET = 0x1c - ETHTOOL_MSG_USER_MAX = 0x21 + ETHTOOL_MSG_FEC_GET = 0x1d + ETHTOOL_MSG_FEC_SET = 0x1e + ETHTOOL_MSG_MODULE_EEPROM_GET = 0x1f + ETHTOOL_MSG_STATS_GET = 0x20 + ETHTOOL_MSG_PHC_VCLOCKS_GET = 0x21 + ETHTOOL_MSG_MODULE_GET = 0x22 + ETHTOOL_MSG_MODULE_SET = 0x23 + ETHTOOL_MSG_USER_MAX = 0x23 ETHTOOL_MSG_KERNEL_NONE = 0x0 ETHTOOL_MSG_STRSET_GET_REPLY = 0x1 ETHTOOL_MSG_LINKINFO_GET_REPLY = 0x2 @@ -3484,7 +3509,14 @@ const ( ETHTOOL_MSG_CABLE_TEST_NTF = 0x1b ETHTOOL_MSG_CABLE_TEST_TDR_NTF = 0x1c ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY = 0x1d - ETHTOOL_MSG_KERNEL_MAX = 0x22 + ETHTOOL_MSG_FEC_GET_REPLY = 0x1e + ETHTOOL_MSG_FEC_NTF = 0x1f + ETHTOOL_MSG_MODULE_EEPROM_GET_REPLY = 0x20 + ETHTOOL_MSG_STATS_GET_REPLY = 0x21 + ETHTOOL_MSG_PHC_VCLOCKS_GET_REPLY = 0x22 + ETHTOOL_MSG_MODULE_GET_REPLY = 0x23 + ETHTOOL_MSG_MODULE_NTF = 0x24 + ETHTOOL_MSG_KERNEL_MAX = 0x24 ETHTOOL_A_HEADER_UNSPEC = 0x0 ETHTOOL_A_HEADER_DEV_INDEX = 0x1 ETHTOOL_A_HEADER_DEV_NAME = 0x2 @@ -3959,3 +3991,77 @@ const ( SHM_RDONLY = 0x1000 SHM_RND = 0x2000 ) + +type MountAttr struct { + Attr_set uint64 + Attr_clr uint64 + Propagation uint64 + Userns_fd uint64 +} + +const ( + WG_CMD_GET_DEVICE = 0x0 + WG_CMD_SET_DEVICE = 0x1 + WGDEVICE_F_REPLACE_PEERS = 0x1 + WGDEVICE_A_UNSPEC = 0x0 + WGDEVICE_A_IFINDEX = 0x1 + WGDEVICE_A_IFNAME = 0x2 + WGDEVICE_A_PRIVATE_KEY = 0x3 + WGDEVICE_A_PUBLIC_KEY = 0x4 + WGDEVICE_A_FLAGS = 0x5 + WGDEVICE_A_LISTEN_PORT = 0x6 + WGDEVICE_A_FWMARK = 0x7 + WGDEVICE_A_PEERS = 0x8 + WGPEER_F_REMOVE_ME = 0x1 + WGPEER_F_REPLACE_ALLOWEDIPS = 0x2 + WGPEER_F_UPDATE_ONLY = 0x4 + WGPEER_A_UNSPEC = 0x0 + WGPEER_A_PUBLIC_KEY = 0x1 + WGPEER_A_PRESHARED_KEY = 0x2 + WGPEER_A_FLAGS = 0x3 + WGPEER_A_ENDPOINT = 0x4 + WGPEER_A_PERSISTENT_KEEPALIVE_INTERVAL = 0x5 + WGPEER_A_LAST_HANDSHAKE_TIME = 0x6 + WGPEER_A_RX_BYTES = 0x7 + WGPEER_A_TX_BYTES = 0x8 + WGPEER_A_ALLOWEDIPS = 0x9 + WGPEER_A_PROTOCOL_VERSION = 0xa + WGALLOWEDIP_A_UNSPEC = 0x0 + WGALLOWEDIP_A_FAMILY = 0x1 + WGALLOWEDIP_A_IPADDR = 0x2 + WGALLOWEDIP_A_CIDR_MASK = 0x3 +) + +const ( + NL_ATTR_TYPE_INVALID = 0x0 + NL_ATTR_TYPE_FLAG = 0x1 + NL_ATTR_TYPE_U8 = 0x2 + NL_ATTR_TYPE_U16 = 0x3 + NL_ATTR_TYPE_U32 = 0x4 + NL_ATTR_TYPE_U64 = 0x5 + NL_ATTR_TYPE_S8 = 0x6 + NL_ATTR_TYPE_S16 = 0x7 + NL_ATTR_TYPE_S32 = 0x8 + NL_ATTR_TYPE_S64 = 0x9 + NL_ATTR_TYPE_BINARY = 0xa + NL_ATTR_TYPE_STRING = 0xb + NL_ATTR_TYPE_NUL_STRING = 0xc + NL_ATTR_TYPE_NESTED = 0xd + NL_ATTR_TYPE_NESTED_ARRAY = 0xe + NL_ATTR_TYPE_BITFIELD32 = 0xf + + NL_POLICY_TYPE_ATTR_UNSPEC = 0x0 + NL_POLICY_TYPE_ATTR_TYPE = 0x1 + NL_POLICY_TYPE_ATTR_MIN_VALUE_S = 0x2 + NL_POLICY_TYPE_ATTR_MAX_VALUE_S = 0x3 + NL_POLICY_TYPE_ATTR_MIN_VALUE_U = 0x4 + NL_POLICY_TYPE_ATTR_MAX_VALUE_U = 0x5 + NL_POLICY_TYPE_ATTR_MIN_LENGTH = 0x6 + NL_POLICY_TYPE_ATTR_MAX_LENGTH = 0x7 + NL_POLICY_TYPE_ATTR_POLICY_IDX = 0x8 + NL_POLICY_TYPE_ATTR_POLICY_MAXTYPE = 0x9 + NL_POLICY_TYPE_ATTR_BITFIELD32_MASK = 0xa + NL_POLICY_TYPE_ATTR_PAD = 0xb + NL_POLICY_TYPE_ATTR_MASK = 0xc + NL_POLICY_TYPE_ATTR_MAX = 0xc +) diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index eeeb9aa3..bea25494 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build 386 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index d30e1155..b8c8f289 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build amd64 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 69d02975..4db44301 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 28a0455b..3ebcad8a 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build arm64 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 64a84548..3eb33e48 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index a1b7dee4..79a94467 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 936fa6a2..8f4b107c 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mips64le && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index 5dd546fb..e4eb2179 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build mipsle && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 947b32e4..d5b21f0f 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 2a606151..5188d142 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index d0d735d0..de4dd4c7 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build ppc64le && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index 95e3d6d0..dccbf9b0 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build riscv64 && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index cccf1ef2..63588061 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build s390x && linux diff --git a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 44fcbe4e..765edc13 100644 --- a/backend/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/backend/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -1,4 +1,4 @@ -// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/linux/types.go | go run mkpost.go +// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/linux/types.go | go run mkpost.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build sparc64 && linux diff --git a/backend/vendor/golang.org/x/time/rate/rate.go b/backend/vendor/golang.org/x/time/rate/rate.go index a114b1aa..b0b982e9 100644 --- a/backend/vendor/golang.org/x/time/rate/rate.go +++ b/backend/vendor/golang.org/x/time/rate/rate.go @@ -53,10 +53,9 @@ func Every(interval time.Duration) Limit { // // The methods AllowN, ReserveN, and WaitN consume n tokens. type Limiter struct { - limit Limit - burst int - mu sync.Mutex + limit Limit + burst int tokens float64 // last is the last time the limiter's tokens field was updated last time.Time @@ -76,6 +75,8 @@ func (lim *Limiter) Limit() Limit { // Burst values allow more events to happen at once. // A zero Burst allows no events, unless limit == Inf. func (lim *Limiter) Burst() int { + lim.mu.Lock() + defer lim.mu.Unlock() return lim.burst } @@ -144,7 +145,6 @@ func (r *Reservation) DelayFrom(now time.Time) time.Duration { // Cancel is shorthand for CancelAt(time.Now()). func (r *Reservation) Cancel() { r.CancelAt(time.Now()) - return } // CancelAt indicates that the reservation holder will not perform the reserved action @@ -185,8 +185,6 @@ func (r *Reservation) CancelAt(now time.Time) { r.lim.lastEvent = prevEvent } } - - return } // Reserve is shorthand for ReserveN(time.Now(), 1). @@ -229,7 +227,7 @@ func (lim *Limiter) WaitN(ctx context.Context, n int) (err error) { lim.mu.Unlock() if n > burst && limit != Inf { - return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, lim.burst) + return fmt.Errorf("rate: Wait(n=%d) exceeds limiter's burst %d", n, burst) } // Check if ctx is already cancelled select { @@ -308,15 +306,27 @@ func (lim *Limiter) SetBurstAt(now time.Time, newBurst int) { // reserveN returns Reservation, not *Reservation, to avoid allocation in AllowN and WaitN. func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duration) Reservation { lim.mu.Lock() + defer lim.mu.Unlock() if lim.limit == Inf { - lim.mu.Unlock() return Reservation{ ok: true, lim: lim, tokens: n, timeToAct: now, } + } else if lim.limit == 0 { + var ok bool + if lim.burst >= n { + ok = true + lim.burst -= n + } + return Reservation{ + ok: ok, + lim: lim, + tokens: lim.burst, + timeToAct: now, + } } now, last, tokens := lim.advance(now) @@ -353,48 +363,43 @@ func (lim *Limiter) reserveN(now time.Time, n int, maxFutureReserve time.Duratio lim.last = last } - lim.mu.Unlock() return r } // advance calculates and returns an updated state for lim resulting from the passage of time. // lim is not changed. +// advance requires that lim.mu is held. func (lim *Limiter) advance(now time.Time) (newNow time.Time, newLast time.Time, newTokens float64) { last := lim.last if now.Before(last) { last = now } - // Avoid making delta overflow below when last is very old. - maxElapsed := lim.limit.durationFromTokens(float64(lim.burst) - lim.tokens) - elapsed := now.Sub(last) - if elapsed > maxElapsed { - elapsed = maxElapsed - } - // Calculate the new number of tokens, due to time that passed. + elapsed := now.Sub(last) delta := lim.limit.tokensFromDuration(elapsed) tokens := lim.tokens + delta if burst := float64(lim.burst); tokens > burst { tokens = burst } - return now, last, tokens } // durationFromTokens is a unit conversion function from the number of tokens to the duration // of time it takes to accumulate them at a rate of limit tokens per second. func (limit Limit) durationFromTokens(tokens float64) time.Duration { + if limit <= 0 { + return InfDuration + } seconds := tokens / float64(limit) - return time.Nanosecond * time.Duration(1e9*seconds) + return time.Duration(float64(time.Second) * seconds) } // tokensFromDuration is a unit conversion function from a time duration to the number of tokens // which could be accumulated during that duration at a rate of limit tokens per second. func (limit Limit) tokensFromDuration(d time.Duration) float64 { - // Split the integer and fractional parts ourself to minimize rounding errors. - // See golang.org/issues/34861. - sec := float64(d/time.Second) * float64(limit) - nsec := float64(d%time.Second) * float64(limit) - return sec + nsec/1e9 + if limit <= 0 { + return 0 + } + return d.Seconds() * float64(limit) } diff --git a/backend/vendor/gopkg.in/yaml.v3/.travis.yml b/backend/vendor/gopkg.in/yaml.v3/.travis.yml deleted file mode 100644 index 04d4dae0..00000000 --- a/backend/vendor/gopkg.in/yaml.v3/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: go - -go: - - "1.4.x" - - "1.5.x" - - "1.6.x" - - "1.7.x" - - "1.8.x" - - "1.9.x" - - "1.10.x" - - "1.11.x" - - "1.12.x" - - "1.13.x" - - "tip" - -go_import_path: gopkg.in/yaml.v3 diff --git a/backend/vendor/gopkg.in/yaml.v3/apic.go b/backend/vendor/gopkg.in/yaml.v3/apic.go index 65846e67..ae7d049f 100644 --- a/backend/vendor/gopkg.in/yaml.v3/apic.go +++ b/backend/vendor/gopkg.in/yaml.v3/apic.go @@ -108,6 +108,7 @@ func yaml_emitter_initialize(emitter *yaml_emitter_t) { raw_buffer: make([]byte, 0, output_raw_buffer_size), states: make([]yaml_emitter_state_t, 0, initial_stack_size), events: make([]yaml_event_t, 0, initial_queue_size), + best_width: -1, } } diff --git a/backend/vendor/gopkg.in/yaml.v3/decode.go b/backend/vendor/gopkg.in/yaml.v3/decode.go index be63169b..df36e3a3 100644 --- a/backend/vendor/gopkg.in/yaml.v3/decode.go +++ b/backend/vendor/gopkg.in/yaml.v3/decode.go @@ -35,6 +35,7 @@ type parser struct { doc *Node anchors map[string]*Node doneInit bool + textless bool } func newParser(b []byte) *parser { @@ -108,14 +109,18 @@ func (p *parser) peek() yaml_event_type_t { func (p *parser) fail() { var where string var line int - if p.parser.problem_mark.line != 0 { + if p.parser.context_mark.line != 0 { + line = p.parser.context_mark.line + // Scanner errors don't iterate line before returning error + if p.parser.error == yaml_SCANNER_ERROR { + line++ + } + } else if p.parser.problem_mark.line != 0 { line = p.parser.problem_mark.line // Scanner errors don't iterate line before returning error if p.parser.error == yaml_SCANNER_ERROR { line++ } - } else if p.parser.context_mark.line != 0 { - line = p.parser.context_mark.line } if line != 0 { where = "line " + strconv.Itoa(line) + ": " @@ -169,17 +174,20 @@ func (p *parser) node(kind Kind, defaultTag, tag, value string) *Node { } else if kind == ScalarNode { tag, _ = resolve("", value) } - return &Node{ - Kind: kind, - Tag: tag, - Value: value, - Style: style, - Line: p.event.start_mark.line + 1, - Column: p.event.start_mark.column + 1, - HeadComment: string(p.event.head_comment), - LineComment: string(p.event.line_comment), - FootComment: string(p.event.foot_comment), + n := &Node{ + Kind: kind, + Tag: tag, + Value: value, + Style: style, } + if !p.textless { + n.Line = p.event.start_mark.line + 1 + n.Column = p.event.start_mark.column + 1 + n.HeadComment = string(p.event.head_comment) + n.LineComment = string(p.event.line_comment) + n.FootComment = string(p.event.foot_comment) + } + return n } func (p *parser) parseChild(parent *Node) *Node { @@ -497,8 +505,13 @@ func (d *decoder) unmarshal(n *Node, out reflect.Value) (good bool) { good = d.mapping(n, out) case SequenceNode: good = d.sequence(n, out) + case 0: + if n.IsZero() { + return d.null(out) + } + fallthrough default: - panic("internal error: unknown node kind: " + strconv.Itoa(int(n.Kind))) + failf("cannot decode node with unknown kind %d", n.Kind) } return good } @@ -533,6 +546,17 @@ func resetMap(out reflect.Value) { } } +func (d *decoder) null(out reflect.Value) bool { + if out.CanAddr() { + switch out.Kind() { + case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: + out.Set(reflect.Zero(out.Type())) + return true + } + } + return false +} + func (d *decoder) scalar(n *Node, out reflect.Value) bool { var tag string var resolved interface{} @@ -550,14 +574,7 @@ func (d *decoder) scalar(n *Node, out reflect.Value) bool { } } if resolved == nil { - if out.CanAddr() { - switch out.Kind() { - case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice: - out.Set(reflect.Zero(out.Type())) - return true - } - } - return false + return d.null(out) } if resolvedv := reflect.ValueOf(resolved); out.Type() == resolvedv.Type() { // We've resolved to exactly the type we want, so use that. @@ -791,8 +808,10 @@ func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { } } + mapIsNew := false if out.IsNil() { out.Set(reflect.MakeMap(outt)) + mapIsNew = true } for i := 0; i < l; i += 2 { if isMerge(n.Content[i]) { @@ -809,7 +828,7 @@ func (d *decoder) mapping(n *Node, out reflect.Value) (good bool) { failf("invalid map key: %#v", k.Interface()) } e := reflect.New(et).Elem() - if d.unmarshal(n.Content[i+1], e) { + if d.unmarshal(n.Content[i+1], e) || n.Content[i+1].ShortTag() == nullTag && (mapIsNew || !out.MapIndex(k).IsValid()) { out.SetMapIndex(k, e) } } diff --git a/backend/vendor/gopkg.in/yaml.v3/emitterc.go b/backend/vendor/gopkg.in/yaml.v3/emitterc.go index ab2a0661..0f47c9ca 100644 --- a/backend/vendor/gopkg.in/yaml.v3/emitterc.go +++ b/backend/vendor/gopkg.in/yaml.v3/emitterc.go @@ -235,10 +235,13 @@ func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool emitter.indent = 0 } } else if !indentless { - emitter.indent += emitter.best_indent - // [Go] If inside a block sequence item, discount the space taken by the indicator. - if emitter.best_indent > 2 && emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { - emitter.indent -= 2 + // [Go] This was changed so that indentations are more regular. + if emitter.states[len(emitter.states)-1] == yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE { + // The first indent inside a sequence will just skip the "- " indicator. + emitter.indent += 2 + } else { + // Everything else aligns to the chosen indentation. + emitter.indent = emitter.best_indent*((emitter.indent+emitter.best_indent)/emitter.best_indent) } } return true @@ -725,16 +728,9 @@ func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_e // Expect a block item node. func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { if first { - // [Go] The original logic here would not indent the sequence when inside a mapping. - // In Go we always indent it, but take the sequence indicator out of the indentation. - indentless := emitter.best_indent == 2 && emitter.mapping_context && (emitter.column == 0 || !emitter.indention) - original := emitter.indent - if !yaml_emitter_increase_indent(emitter, false, indentless) { + if !yaml_emitter_increase_indent(emitter, false, false) { return false } - if emitter.indent > original+2 { - emitter.indent -= 2 - } } if event.typ == yaml_SEQUENCE_END_EVENT { emitter.indent = emitter.indents[len(emitter.indents)-1] @@ -785,6 +781,13 @@ func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_ev if !yaml_emitter_write_indent(emitter) { return false } + if len(emitter.line_comment) > 0 { + // [Go] A line comment was provided for the key. That's unusual as the + // scanner associates line comments with the value. Either way, + // save the line comment and render it appropriately later. + emitter.key_line_comment = emitter.line_comment + emitter.line_comment = nil + } if yaml_emitter_check_simple_key(emitter) { emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) return yaml_emitter_emit_node(emitter, event, false, false, true, true) @@ -810,6 +813,27 @@ func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_ return false } } + if len(emitter.key_line_comment) > 0 { + // [Go] Line comments are generally associated with the value, but when there's + // no value on the same line as a mapping key they end up attached to the + // key itself. + if event.typ == yaml_SCALAR_EVENT { + if len(emitter.line_comment) == 0 { + // A scalar is coming and it has no line comments by itself yet, + // so just let it handle the line comment as usual. If it has a + // line comment, we can't have both so the one from the key is lost. + emitter.line_comment = emitter.key_line_comment + emitter.key_line_comment = nil + } + } else if event.sequence_style() != yaml_FLOW_SEQUENCE_STYLE && (event.typ == yaml_MAPPING_START_EVENT || event.typ == yaml_SEQUENCE_START_EVENT) { + // An indented block follows, so write the comment right now. + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + if !yaml_emitter_process_line_comment(emitter) { + return false + } + emitter.line_comment, emitter.key_line_comment = emitter.key_line_comment, emitter.line_comment + } + } emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) if !yaml_emitter_emit_node(emitter, event, false, false, true, false) { return false @@ -823,6 +847,10 @@ func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_ return true } +func yaml_emitter_silent_nil_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { + return event.typ == yaml_SCALAR_EVENT && event.implicit && !emitter.canonical && len(emitter.scalar_data.value) == 0 +} + // Expect a node. func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, root bool, sequence bool, mapping bool, simple_key bool) bool { @@ -1866,7 +1894,7 @@ func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bo if !yaml_emitter_write_block_scalar_hints(emitter, value) { return false } - if !put_break(emitter) { + if !yaml_emitter_process_line_comment(emitter) { return false } //emitter.indention = true @@ -1903,10 +1931,10 @@ func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) boo if !yaml_emitter_write_block_scalar_hints(emitter, value) { return false } - - if !put_break(emitter) { + if !yaml_emitter_process_line_comment(emitter) { return false } + //emitter.indention = true emitter.whitespace = true diff --git a/backend/vendor/gopkg.in/yaml.v3/encode.go b/backend/vendor/gopkg.in/yaml.v3/encode.go index 1f37271c..de9e72a3 100644 --- a/backend/vendor/gopkg.in/yaml.v3/encode.go +++ b/backend/vendor/gopkg.in/yaml.v3/encode.go @@ -119,6 +119,14 @@ func (e *encoder) marshal(tag string, in reflect.Value) { case *Node: e.nodev(in) return + case Node: + if !in.CanAddr() { + var n = reflect.New(in.Type()).Elem() + n.Set(in) + in = n + } + e.nodev(in.Addr()) + return case time.Time: e.timev(tag, in) return @@ -422,18 +430,23 @@ func (e *encoder) nodev(in reflect.Value) { } func (e *encoder) node(node *Node, tail string) { + // Zero nodes behave as nil. + if node.Kind == 0 && node.IsZero() { + e.nilv() + return + } + // If the tag was not explicitly requested, and dropping it won't change the // implicit tag of the value, don't include it in the presentation. var tag = node.Tag var stag = shortTag(tag) - var rtag string var forceQuoting bool if tag != "" && node.Style&TaggedStyle == 0 { if node.Kind == ScalarNode { if stag == strTag && node.Style&(SingleQuotedStyle|DoubleQuotedStyle|LiteralStyle|FoldedStyle) != 0 { tag = "" } else { - rtag, _ = resolve("", node.Value) + rtag, _ := resolve("", node.Value) if rtag == stag { tag = "" } else if stag == strTag { @@ -442,6 +455,7 @@ func (e *encoder) node(node *Node, tail string) { } } } else { + var rtag string switch node.Kind { case MappingNode: rtag = mapTag @@ -471,7 +485,7 @@ func (e *encoder) node(node *Node, tail string) { if node.Style&FlowStyle != 0 { style = yaml_FLOW_SEQUENCE_STYLE } - e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(tag), tag == "", style)) + e.must(yaml_sequence_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style)) e.event.head_comment = []byte(node.HeadComment) e.emit() for _, node := range node.Content { @@ -487,7 +501,7 @@ func (e *encoder) node(node *Node, tail string) { if node.Style&FlowStyle != 0 { style = yaml_FLOW_MAPPING_STYLE } - yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(tag), tag == "", style) + yaml_mapping_start_event_initialize(&e.event, []byte(node.Anchor), []byte(longTag(tag)), tag == "", style) e.event.tail_comment = []byte(tail) e.event.head_comment = []byte(node.HeadComment) e.emit() @@ -528,11 +542,11 @@ func (e *encoder) node(node *Node, tail string) { case ScalarNode: value := node.Value if !utf8.ValidString(value) { - if tag == binaryTag { + if stag == binaryTag { failf("explicitly tagged !!binary data must be base64-encoded") } - if tag != "" { - failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) + if stag != "" { + failf("cannot marshal invalid UTF-8 data as %s", stag) } // It can't be encoded directly as YAML so use a binary tag // and encode it as base64. @@ -557,5 +571,7 @@ func (e *encoder) node(node *Node, tail string) { } e.emitScalar(value, node.Anchor, tag, style, []byte(node.HeadComment), []byte(node.LineComment), []byte(node.FootComment), []byte(tail)) + default: + failf("cannot encode node with unknown kind %d", node.Kind) } } diff --git a/backend/vendor/gopkg.in/yaml.v3/parserc.go b/backend/vendor/gopkg.in/yaml.v3/parserc.go index aea9050b..ac66fccc 100644 --- a/backend/vendor/gopkg.in/yaml.v3/parserc.go +++ b/backend/vendor/gopkg.in/yaml.v3/parserc.go @@ -648,6 +648,10 @@ func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, i implicit: implicit, style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), } + if parser.stem_comment != nil { + event.head_comment = parser.stem_comment + parser.stem_comment = nil + } return true } if len(anchor) > 0 || len(tag) > 0 { @@ -694,25 +698,13 @@ func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_e if token.typ == yaml_BLOCK_ENTRY_TOKEN { mark := token.end_mark - prior_head := len(parser.head_comment) + prior_head_len := len(parser.head_comment) skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) token = peek_token(parser) if token == nil { return false } - if prior_head > 0 && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { - // [Go] It's a sequence under a sequence entry, so the former head comment - // is for the list itself, not the first list item under it. - parser.stem_comment = parser.head_comment[:prior_head] - if len(parser.head_comment) == prior_head { - parser.head_comment = nil - } else { - // Copy suffix to prevent very strange bugs if someone ever appends - // further bytes to the prefix in the stem_comment slice above. - parser.head_comment = append([]byte(nil), parser.head_comment[prior_head+1:]...) - } - - } if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) return yaml_parser_parse_node(parser, event, true, false) @@ -754,7 +746,9 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y if token.typ == yaml_BLOCK_ENTRY_TOKEN { mark := token.end_mark + prior_head_len := len(parser.head_comment) skip_token(parser) + yaml_parser_split_stem_comment(parser, prior_head_len) token = peek_token(parser) if token == nil { return false @@ -780,6 +774,32 @@ func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *y return true } +// Split stem comment from head comment. +// +// When a sequence or map is found under a sequence entry, the former head comment +// is assigned to the underlying sequence or map as a whole, not the individual +// sequence or map entry as would be expected otherwise. To handle this case the +// previous head comment is moved aside as the stem comment. +func yaml_parser_split_stem_comment(parser *yaml_parser_t, stem_len int) { + if stem_len == 0 { + return + } + + token := peek_token(parser) + if token.typ != yaml_BLOCK_SEQUENCE_START_TOKEN && token.typ != yaml_BLOCK_MAPPING_START_TOKEN { + return + } + + parser.stem_comment = parser.head_comment[:stem_len] + if len(parser.head_comment) == stem_len { + parser.head_comment = nil + } else { + // Copy suffix to prevent very strange bugs if someone ever appends + // further bytes to the prefix in the stem_comment slice above. + parser.head_comment = append([]byte(nil), parser.head_comment[stem_len+1:]...) + } +} + // Parse the productions: // block_mapping ::= BLOCK-MAPPING_START // ******************* diff --git a/backend/vendor/gopkg.in/yaml.v3/scannerc.go b/backend/vendor/gopkg.in/yaml.v3/scannerc.go index 57e954ca..ca007010 100644 --- a/backend/vendor/gopkg.in/yaml.v3/scannerc.go +++ b/backend/vendor/gopkg.in/yaml.v3/scannerc.go @@ -749,6 +749,11 @@ func yaml_parser_fetch_next_token(parser *yaml_parser_t) (ok bool) { if !ok { return } + if len(parser.tokens) > 0 && parser.tokens[len(parser.tokens)-1].typ == yaml_BLOCK_ENTRY_TOKEN { + // Sequence indicators alone have no line comments. It becomes + // a head comment for whatever follows. + return + } if !yaml_parser_scan_line_comment(parser, comment_mark) { ok = false return @@ -2255,10 +2260,9 @@ func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, l } } if parser.buffer[parser.buffer_pos] == '#' { - // TODO Test this and then re-enable it. - //if !yaml_parser_scan_line_comment(parser, start_mark) { - // return false - //} + if !yaml_parser_scan_line_comment(parser, start_mark) { + return false + } for !is_breakz(parser.buffer, parser.buffer_pos) { skip(parser) if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { @@ -2856,13 +2860,12 @@ func yaml_parser_scan_line_comment(parser *yaml_parser_t, token_mark yaml_mark_t return false } skip_line(parser) - } else { - if parser.mark.index >= seen { - if len(text) == 0 { - start_mark = parser.mark - } - text = append(text, parser.buffer[parser.buffer_pos]) + } else if parser.mark.index >= seen { + if len(text) == 0 { + start_mark = parser.mark } + text = read(parser, text) + } else { skip(parser) } } @@ -2888,6 +2891,10 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo var token_mark = token.start_mark var start_mark yaml_mark_t + var next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } var recent_empty = false var first_empty = parser.newlines <= 1 @@ -2919,15 +2926,18 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo continue } c := parser.buffer[parser.buffer_pos+peek] - if is_breakz(parser.buffer, parser.buffer_pos+peek) || parser.flow_level > 0 && (c == ']' || c == '}') { + var close_flow = parser.flow_level > 0 && (c == ']' || c == '}') + if close_flow || is_breakz(parser.buffer, parser.buffer_pos+peek) { // Got line break or terminator. - if !recent_empty { - if first_empty && (start_mark.line == foot_line || start_mark.column-1 < parser.indent) { + if close_flow || !recent_empty { + if close_flow || first_empty && (start_mark.line == foot_line && token.typ != yaml_VALUE_TOKEN || start_mark.column-1 < next_indent) { // This is the first empty line and there were no empty lines before, // so this initial part of the comment is a foot of the prior token // instead of being a head for the following one. Split it up. + // Alternatively, this might also be the last comment inside a flow + // scope, so it must be a footer. if len(text) > 0 { - if start_mark.column-1 < parser.indent { + if start_mark.column-1 < next_indent { // If dedented it's unrelated to the prior token. token_mark = start_mark } @@ -2958,7 +2968,7 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo continue } - if len(text) > 0 && column < parser.indent+1 && column != start_mark.column { + if len(text) > 0 && (close_flow || column-1 < next_indent && column != start_mark.column) { // The comment at the different indentation is a foot of the // preceding data rather than a head of the upcoming one. parser.comments = append(parser.comments, yaml_comment_t{ @@ -2999,10 +3009,9 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo return false } skip_line(parser) + } else if parser.mark.index >= seen { + text = read(parser, text) } else { - if parser.mark.index >= seen { - text = append(text, parser.buffer[parser.buffer_pos]) - } skip(parser) } } @@ -3010,6 +3019,10 @@ func yaml_parser_scan_comments(parser *yaml_parser_t, scan_mark yaml_mark_t) boo peek = 0 column = 0 line = parser.mark.line + next_indent = parser.indent + if next_indent < 0 { + next_indent = 0 + } } if len(text) > 0 { diff --git a/backend/vendor/gopkg.in/yaml.v3/yaml.go b/backend/vendor/gopkg.in/yaml.v3/yaml.go index b5d35a50..8cec6da4 100644 --- a/backend/vendor/gopkg.in/yaml.v3/yaml.go +++ b/backend/vendor/gopkg.in/yaml.v3/yaml.go @@ -89,7 +89,7 @@ func Unmarshal(in []byte, out interface{}) (err error) { return unmarshal(in, out, false) } -// A Decorder reads and decodes YAML values from an input stream. +// A Decoder reads and decodes YAML values from an input stream. type Decoder struct { parser *parser knownFields bool @@ -194,7 +194,7 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) { // Zero valued structs will be omitted if all their public // fields are zero, unless they implement an IsZero // method (see the IsZeroer interface type), in which -// case the field will be included if that method returns true. +// case the field will be excluded if IsZero returns true. // // flow Marshal using a flow style (useful for structs, // sequences and maps). @@ -252,6 +252,24 @@ func (e *Encoder) Encode(v interface{}) (err error) { return nil } +// Encode encodes value v and stores its representation in n. +// +// See the documentation for Marshal for details about the +// conversion of Go values into YAML. +func (n *Node) Encode(v interface{}) (err error) { + defer handleErr(&err) + e := newEncoder() + defer e.destroy() + e.marshalDoc("", reflect.ValueOf(v)) + e.finish() + p := newParser(e.out) + p.textless = true + defer p.destroy() + doc := p.parse() + *n = *doc.Content[0] + return nil +} + // SetIndent changes the used indentation used when encoding. func (e *Encoder) SetIndent(spaces int) { if spaces < 0 { @@ -328,6 +346,12 @@ const ( // and maps, Node is an intermediate representation that allows detailed // control over the content being decoded or encoded. // +// It's worth noting that although Node offers access into details such as +// line numbers, colums, and comments, the content when re-encoded will not +// have its original textual representation preserved. An effort is made to +// render the data plesantly, and to preserve comments near the data they +// describe, though. +// // Values that make use of the Node type interact with the yaml package in the // same way any other type would do, by encoding and decoding yaml data // directly or indirectly into them. @@ -391,6 +415,13 @@ type Node struct { Column int } +// IsZero returns whether the node has all of its fields unset. +func (n *Node) IsZero() bool { + return n.Kind == 0 && n.Style == 0 && n.Tag == "" && n.Value == "" && n.Anchor == "" && n.Alias == nil && n.Content == nil && + n.HeadComment == "" && n.LineComment == "" && n.FootComment == "" && n.Line == 0 && n.Column == 0 +} + + // LongTag returns the long form of the tag that indicates the data type for // the node. If the Tag field isn't explicitly defined, one will be computed // based on the node properties. @@ -418,6 +449,11 @@ func (n *Node) ShortTag() string { case ScalarNode: tag, _ := resolve("", n.Value) return tag + case 0: + // Special case to make the zero value convenient. + if n.IsZero() { + return nullTag + } } return "" } diff --git a/backend/vendor/gopkg.in/yaml.v3/yamlh.go b/backend/vendor/gopkg.in/yaml.v3/yamlh.go index 2719cfbb..7c6d0077 100644 --- a/backend/vendor/gopkg.in/yaml.v3/yamlh.go +++ b/backend/vendor/gopkg.in/yaml.v3/yamlh.go @@ -787,6 +787,8 @@ type yaml_emitter_t struct { foot_comment []byte tail_comment []byte + key_line_comment []byte + // Dumper stuff opened bool // If the stream was already opened? diff --git a/backend/vendor/modules.txt b/backend/vendor/modules.txt index c3c41f64..d82e7040 100644 --- a/backend/vendor/modules.txt +++ b/backend/vendor/modules.txt @@ -1,4 +1,4 @@ -# cloud.google.com/go v0.97.0 +# cloud.google.com/go/compute v1.1.0 cloud.google.com/go/compute/metadata # github.com/Depado/bfchroma v1.3.0 ## explicit @@ -6,7 +6,7 @@ github.com/Depado/bfchroma # github.com/PuerkitoBio/goquery v1.8.0 ## explicit github.com/PuerkitoBio/goquery -# github.com/alecthomas/chroma v0.9.4 +# github.com/alecthomas/chroma v0.10.0 ## explicit github.com/alecthomas/chroma github.com/alecthomas/chroma/formatters/html @@ -46,7 +46,7 @@ github.com/aymerick/douceur/css github.com/aymerick/douceur/parser # github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew/spew -# github.com/dghubble/oauth1 v0.7.0 +# github.com/dghubble/oauth1 v0.7.1 github.com/dghubble/oauth1 github.com/dghubble/oauth1/twitter # github.com/didip/tollbooth/v6 v6.1.1 @@ -64,7 +64,7 @@ github.com/dlclark/regexp2/syntax # github.com/go-chi/chi v4.1.1+incompatible github.com/go-chi/chi github.com/go-chi/chi/middleware -# github.com/go-chi/chi/v5 v5.0.5 +# github.com/go-chi/chi/v5 v5.0.7 ## explicit github.com/go-chi/chi/v5 github.com/go-chi/chi/v5/middleware @@ -74,7 +74,7 @@ github.com/go-chi/cors # github.com/go-chi/render v1.0.1 ## explicit github.com/go-chi/render -# github.com/go-pkgz/auth v1.18.1-0.20211207184750-78e5d290333d +# github.com/go-pkgz/auth v1.18.1-0.20220131194604-2eb160b3c90c ## explicit github.com/go-pkgz/auth github.com/go-pkgz/auth/avatar @@ -100,14 +100,15 @@ github.com/go-pkgz/lgr ## explicit github.com/go-pkgz/repeater github.com/go-pkgz/repeater/strategy -# github.com/go-pkgz/rest v1.11.0 +# github.com/go-pkgz/rest v1.12.2 ## explicit github.com/go-pkgz/rest github.com/go-pkgz/rest/logger -# github.com/go-pkgz/syncs v1.1.1 +# github.com/go-pkgz/syncs v1.2.0 ## explicit github.com/go-pkgz/syncs -# github.com/go-redis/redis/v7 v7.4.0 +# github.com/go-redis/redis/v7 v7.4.1 +## explicit github.com/go-redis/redis/v7 github.com/go-redis/redis/v7/internal github.com/go-redis/redis/v7/internal/consistenthash @@ -134,7 +135,8 @@ github.com/gorilla/css/scanner github.com/gorilla/feeds # github.com/gorilla/websocket v1.4.2 github.com/gorilla/websocket -# github.com/hashicorp/errwrap v1.0.0 +# github.com/hashicorp/errwrap v1.1.0 +## explicit github.com/hashicorp/errwrap # github.com/hashicorp/go-multierror v1.1.1 ## explicit @@ -142,7 +144,10 @@ github.com/hashicorp/go-multierror # github.com/hashicorp/golang-lru v0.5.4 github.com/hashicorp/golang-lru github.com/hashicorp/golang-lru/simplelru -# github.com/klauspost/compress v1.13.6 +# github.com/jessevdk/go-flags v1.5.0 +## explicit +github.com/jessevdk/go-flags +# github.com/klauspost/compress v1.14.2 github.com/klauspost/compress github.com/klauspost/compress/fse github.com/klauspost/compress/huff0 @@ -152,7 +157,7 @@ github.com/klauspost/compress/zstd/internal/xxhash # github.com/kyokomi/emoji/v2 v2.2.8 ## explicit github.com/kyokomi/emoji/v2 -# github.com/microcosm-cc/bluemonday v1.0.16 +# github.com/microcosm-cc/bluemonday v1.0.17 ## explicit github.com/microcosm-cc/bluemonday github.com/microcosm-cc/bluemonday/css @@ -172,7 +177,7 @@ github.com/rs/xid # github.com/russross/blackfriday/v2 v2.1.0 ## explicit github.com/russross/blackfriday/v2 -# github.com/slack-go/slack v0.9.5 +# github.com/slack-go/slack v0.10.1 ## explicit github.com/slack-go/slack github.com/slack-go/slack/internal/backoff @@ -180,19 +185,19 @@ github.com/slack-go/slack/internal/errorsx github.com/slack-go/slack/internal/misc github.com/slack-go/slack/internal/timex github.com/slack-go/slack/slackutilsx -# github.com/stretchr/objx v0.1.1 +# github.com/stretchr/objx v0.3.0 +## explicit github.com/stretchr/objx # github.com/stretchr/testify v1.7.0 ## explicit github.com/stretchr/testify/assert github.com/stretchr/testify/mock github.com/stretchr/testify/require -# github.com/umputun/go-flags v1.5.1 +# github.com/tidwall/gjson v1.11.0 ## explicit -github.com/umputun/go-flags # github.com/xdg-go/pbkdf2 v1.0.0 github.com/xdg-go/pbkdf2 -# github.com/xdg-go/scram v1.0.2 +# github.com/xdg-go/scram v1.1.0 github.com/xdg-go/scram # github.com/xdg-go/stringprep v1.0.2 github.com/xdg-go/stringprep @@ -201,7 +206,7 @@ github.com/youmark/pkcs8 # go.etcd.io/bbolt v1.3.6 ## explicit go.etcd.io/bbolt -# go.mongodb.org/mongo-driver v1.7.4 +# go.mongodb.org/mongo-driver v1.8.2 go.mongodb.org/mongo-driver/bson go.mongodb.org/mongo-driver/bson/bsoncodec go.mongodb.org/mongo-driver/bson/bsonoptions @@ -210,6 +215,7 @@ go.mongodb.org/mongo-driver/bson/bsontype go.mongodb.org/mongo-driver/bson/primitive go.mongodb.org/mongo-driver/event go.mongodb.org/mongo-driver/internal +go.mongodb.org/mongo-driver/internal/randutil go.mongodb.org/mongo-driver/mongo go.mongodb.org/mongo-driver/mongo/address go.mongodb.org/mongo-driver/mongo/description @@ -240,7 +246,7 @@ go.mongodb.org/mongo-driver/x/mongo/driver/wiremessage ## explicit go.uber.org/goleak go.uber.org/goleak/internal/stack -# golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 +# golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed ## explicit golang.org/x/crypto/acme golang.org/x/crypto/acme/autocert @@ -251,7 +257,7 @@ golang.org/x/crypto/scrypt ## explicit golang.org/x/image/draw golang.org/x/image/math/f64 -# golang.org/x/net v0.0.0-20211105192438-b53810dc28af +# golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd ## explicit golang.org/x/net/context golang.org/x/net/context/ctxhttp @@ -272,8 +278,7 @@ golang.org/x/oauth2/microsoft golang.org/x/oauth2/yandex # golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sync/errgroup -golang.org/x/sync/semaphore -# golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c +# golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix # golang.org/x/text v0.3.7 @@ -281,7 +286,8 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 +# golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 +## explicit golang.org/x/time/rate # google.golang.org/appengine v1.6.7 google.golang.org/appengine @@ -326,5 +332,8 @@ google.golang.org/protobuf/types/descriptorpb gopkg.in/oauth2.v3 gopkg.in/oauth2.v3/errors gopkg.in/oauth2.v3/server -# gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c +# gopkg.in/yaml.v2 v2.2.8 +## explicit +# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b +## explicit gopkg.in/yaml.v3