diff --git a/go.mod b/go.mod index 64a03ae..554a055 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,31 @@ require ( github.com/valyala/fasthttp v1.50.0 ) +require ( + github.com/bodgit/plumbing v1.2.0 // indirect + github.com/bodgit/sevenzip v1.3.0 // indirect + github.com/bodgit/windows v1.0.0 // indirect + github.com/connesc/cipherio v0.2.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/dsnet/compress v0.0.1 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/klauspost/pgzip v1.2.5 // indirect + github.com/mholt/archiver/v4 v4.0.0-alpha.8 // indirect + github.com/nwaples/rardecode v1.1.3 // indirect + github.com/nwaples/rardecode/v2 v2.0.0-beta.2 // indirect + github.com/pierrec/lz4 v2.6.1+incompatible // indirect + github.com/pierrec/lz4/v4 v4.1.15 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect + github.com/therootcompany/xz v1.0.1 // indirect + github.com/ulikunitz/xz v0.5.10 // indirect + github.com/urfave/cli/v2 v2.26.0 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect + go4.org v0.0.0-20200411211856-f5505b9728dd // indirect +) + require ( github.com/andybalholm/brotli v1.0.5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect @@ -20,6 +45,7 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/mholt/archiver v3.1.1+incompatible github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/philhofer/fwd v1.1.2 // indirect diff --git a/go.sum b/go.sum index 7014df3..2d19e27 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,12 @@ github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= +github.com/bodgit/plumbing v1.2.0 h1:gg4haxoKphLjml+tgnecR4yLBV5zo4HAZGCtAh3xCzM= +github.com/bodgit/plumbing v1.2.0/go.mod h1:b9TeRi7Hvc6Y05rjm8VML3+47n4XTZPtQ/5ghqic2n8= +github.com/bodgit/sevenzip v1.3.0 h1:1ljgELgtHqvgIp8W8kgeEGHIWP4ch3xGI8uOBZgLVKY= +github.com/bodgit/sevenzip v1.3.0/go.mod h1:omwNcgZTEooWM8gA/IJ2Nk/+ZQ94+GsytRzOJJ8FBlM= +github.com/bodgit/windows v1.0.0 h1:rLQ/XjsleZvx4fR1tB/UxQrK+SJ2OFHzfPjLWWOhDIA= +github.com/bodgit/windows v1.0.0/go.mod h1:a6JLwrB4KrTR5hBpp8FI9/9W9jJfeQ2h4XDXU74ZCdM= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -54,12 +60,19 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/connesc/cipherio v0.2.1 h1:FGtpTPMbKNNWByNrr9aEBtaJtXjqOzkIXNYJp6OEycw= +github.com/connesc/cipherio v0.2.1/go.mod h1:ukY0MWJDFnJEbXMQtOcn2VmTpRfzcTz4OoVrWGGJZcA= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= +github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q= +github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo= +github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -105,6 +118,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -142,9 +157,13 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qKpsEkdD5+I6QGU= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/hashicorp/consul/api v1.25.1/go.mod h1:iiLVwR/htV7mas/sy0O+XSuEnrdBUUydemjxcUrAt4g= +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/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +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= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -158,8 +177,12 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm 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/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -178,6 +201,10 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mholt/archiver v3.1.1+incompatible h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU= +github.com/mholt/archiver v3.1.1+incompatible/go.mod h1:Dh2dOXnSdiLxRiPoVfIr/fI1TwETms9B8CTWfeh7ROU= +github.com/mholt/archiver/v4 v4.0.0-alpha.8 h1:tRGQuDVPh66WCOelqe6LIGh0gwmfwxUrSSDunscGsRM= +github.com/mholt/archiver/v4 v4.0.0-alpha.8/go.mod h1:5f7FUYGXdJWUjESffJaYR4R60VhnHxb2X3T1teMyv5A= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -188,10 +215,18 @@ github.com/nats-io/jwt/v2 v2.4.1/go.mod h1:24BeQtRwxRV8ruvC4CojXlx/WQ/VjuwlYiH+v github.com/nats-io/nats.go v1.30.2/go.mod h1:dcfhUgmQNN4GJEfIb2f9R7Fow+gzBF4emzDHrVBd5qM= github.com/nats-io/nkeys v0.4.5/go.mod h1:XUkxdLPTufzlihbamfzQ7mw/VGx6ObUs+0bN5sNvt64= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= +github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc= +github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= +github.com/nwaples/rardecode/v2 v2.0.0-beta.2 h1:e3mzJFJs4k83GXBEiTaQ5HgSc/kOK8q0rDaRO0MPaOk= +github.com/nwaples/rardecode/v2 v2.0.0-beta.2/go.mod h1:yntwv/HfMc/Hbvtq9I19D1n58te3h6KsqCf3GxyfBGY= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= +github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= +github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.15 h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0= +github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -206,6 +241,9 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= github.com/rs/zerolog v1.31.0 h1:FcTR3NnLWW+NnTwwhFWiJSZr4ECLpqCm6QsEnyvbV4A= github.com/rs/zerolog v1.31.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/rwcarlsen/goexif v0.0.0-20190401172101-9e8deecbddbd/go.mod h1:hPqNNc0+uJM6H+SuU8sEs5K5IQeKccPqeSjfgcKGgPk= github.com/sagikazarmark/crypt v0.15.0/go.mod h1:5rwNNax6Mlk9sZ40AcyVtiEw24Z4J04cfSioF2COKmc= github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ= github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U= @@ -236,14 +274,25 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +github.com/therootcompany/xz v1.0.1 h1:CmOtsn1CbtmyYiusbfmhmkpAAETj0wBIH6kCYaX+xzw= +github.com/therootcompany/xz v1.0.1/go.mod h1:3K3UH1yCKgBneZYhuQUvJ9HPD19UEXEI0BWbMn8qNMY= github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0= github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw= +github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= +github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI= +github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= 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.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e9M= github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA= github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= +github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -265,6 +314,8 @@ go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw= +go4.org v0.0.0-20200411211856-f5505b9728dd h1:BNJlw5kRTzdmyfh5U8F93HA2OwkP7ZGwA51eJ/0wKOU= +go4.org v0.0.0-20200411211856-f5505b9728dd/go.mod h1:CIiUVy99QCPfoE13bO4EZaz5GZMZXMSBGhxRdsvzbkg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 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= diff --git a/pkg/administration/connectivity.go b/pkg/administration/connectivity.go new file mode 100644 index 0000000..d9d5134 --- /dev/null +++ b/pkg/administration/connectivity.go @@ -0,0 +1,13 @@ +package administration + +import ( + roadsign "code.smartsheep.studio/goatworks/roadsign/pkg" + "github.com/gofiber/fiber/v2" +) + +func responseConnectivity(c *fiber.Ctx) error { + return c.Status(fiber.StatusOK).JSON(fiber.Map{ + "server": "RoadSign", + "version": roadsign.AppVersion, + }) +} diff --git a/pkg/administration/publish.go b/pkg/administration/publish.go index a28a523..b3a0b62 100644 --- a/pkg/administration/publish.go +++ b/pkg/administration/publish.go @@ -8,14 +8,17 @@ import ( "code.smartsheep.studio/goatworks/roadsign/pkg/sign" "github.com/gofiber/fiber/v2" "github.com/google/uuid" + "github.com/samber/lo" ) -func doPublish(ctx *fiber.Ctx) error { +func doPublish(c *fiber.Ctx) error { var upstream *sign.UpstreamConfig + var site *sign.SiteConfig for _, item := range sign.App.Sites { - if item.ID == ctx.Params("site") { + if item.ID == c.Params("site") { + site = item for _, stream := range item.Upstreams { - if stream.ID == ctx.Params("upstream") { + if stream.ID == c.Params("upstream") { upstream = stream break } @@ -30,35 +33,39 @@ func doPublish(ctx *fiber.Ctx) error { return fiber.ErrUnprocessableEntity } + for _, process := range site.Processes { + process.StopProcess() + } + workdir, _ := upstream.GetRawURI() - if ctx.Query("overwrite", "yes") == "yes" { + if c.Query("overwrite", "yes") == "yes" { files, _ := filepath.Glob(filepath.Join(workdir, "*")) for _, file := range files { _ = os.Remove(file) } } - if form, err := ctx.MultipartForm(); err == nil { + if form, err := c.MultipartForm(); err == nil { files := form.File["attachments"] for _, file := range files { - mimetype := file.Header["Content-Type"][0] + mimetype := lo.Ternary(len(c.Query("mimetype")) > 0, c.Query("mimetype"), file.Header["Content-Type"][0]) switch mimetype { case "application/zip": dst := filepath.Join(os.TempDir(), uuid.NewString()+".zip") - if err := ctx.SaveFile(file, dst); err != nil { + if err := c.SaveFile(file, dst); err != nil { return err } else { _ = filesystem.Unzip(dst, workdir) } default: dst := filepath.Join(workdir, file.Filename) - if err := ctx.SaveFile(file, dst); err != nil { + if err := c.SaveFile(file, dst); err != nil { return err } } } } - return ctx.SendStatus(fiber.StatusOK) + return c.SendStatus(fiber.StatusOK) } diff --git a/pkg/administration/server.go b/pkg/administration/server.go index 69dd49c..4a7425f 100644 --- a/pkg/administration/server.go +++ b/pkg/administration/server.go @@ -35,6 +35,11 @@ func InitAdministration() *fiber.App { }, })) + cgi := app.Group("/cgi").Name("CGI") + { + cgi.All("/connectivity", responseConnectivity) + } + webhooks := app.Group("/webhooks").Name("WebHooks") { webhooks.Put("/publish/:site/:upstream", doPublish) diff --git a/pkg/cmd/rds/conn/commands.go b/pkg/cmd/rds/conn/commands.go new file mode 100644 index 0000000..2942075 --- /dev/null +++ b/pkg/cmd/rds/conn/commands.go @@ -0,0 +1,89 @@ +package conn + +import ( + "encoding/json" + "fmt" + + "github.com/rs/zerolog/log" + "github.com/samber/lo" + "github.com/spf13/viper" + "github.com/urfave/cli/v2" +) + +var CliCommands = []*cli.Command{ + { + Name: "list", + Aliases: []string{"ls"}, + Description: "List all connected remote server", + Action: func(ctx *cli.Context) error { + var servers []CliConnection + raw, _ := json.Marshal(viper.Get("servers")) + _ = json.Unmarshal(raw, &servers) + + log.Info().Msgf("There are %d server(s) connected in total.", len(servers)) + for idx, server := range servers { + log.Info().Msgf("%d) %s: %s", idx+1, server.ID, server.Url) + } + + return nil + }, + }, + { + Name: "connect", + Aliases: []string{"add"}, + Description: "Connect and save configuration of remote server", + ArgsUsage: " ", + Action: func(ctx *cli.Context) error { + if ctx.Args().Len() < 3 { + return fmt.Errorf("must have three arguments: ") + } + + c := CliConnection{ + ID: ctx.Args().Get(0), + Url: ctx.Args().Get(1), + Credential: ctx.Args().Get(2), + } + + if err := c.GetConnectivity(); err != nil { + return fmt.Errorf("couldn't connect server: %s", err.Error()) + } else { + var servers []CliConnection + raw, _ := json.Marshal(viper.Get("servers")) + _ = json.Unmarshal(raw, &servers) + viper.Set("servers", append(servers, c)) + + if err := viper.WriteConfig(); err != nil { + return err + } else { + log.Info().Msg("Successfully connected a new remote server, enter \"rds ls\" to get more info.") + return nil + } + } + }, + }, + { + Name: "disconnect", + Aliases: []string{"remove"}, + Description: "Remove a remote server configuration", + ArgsUsage: "", + Action: func(ctx *cli.Context) error { + if ctx.Args().Len() < 1 { + return fmt.Errorf("must have more one arguments: ") + } + + var servers []CliConnection + raw, _ := json.Marshal(viper.Get("servers")) + _ = json.Unmarshal(raw, &servers) + viper.Set("servers", lo.Filter(servers, func(item CliConnection, idx int) bool { + return item.ID != ctx.Args().Get(0) + })) + + if err := viper.WriteConfig(); err != nil { + return err + } else { + log.Info().Msg("Successfully disconnected a remote server, enter \"rds ls\" to get more info.") + return nil + } + }, + }, +} diff --git a/pkg/cmd/rds/conn/connect.go b/pkg/cmd/rds/conn/connect.go new file mode 100644 index 0000000..bdc0b21 --- /dev/null +++ b/pkg/cmd/rds/conn/connect.go @@ -0,0 +1,37 @@ +package conn + +import ( + "encoding/json" + "fmt" + + roadsign "code.smartsheep.studio/goatworks/roadsign/pkg" + "github.com/gofiber/fiber/v2" + "github.com/rs/zerolog/log" +) + +type CliConnection struct { + ID string `json:"id"` + Url string `json:"url"` + Credential string `json:"credential"` +} + +func (v CliConnection) GetConnectivity() error { + client := fiber.Get(v.Url + "/cgi/connectivity") + client.BasicAuth("RoadSign CLI", v.Credential) + + if status, data, err := client.Bytes(); len(err) > 0 { + return fmt.Errorf("couldn't connect to server: %q", err) + } else if status != 200 { + return fmt.Errorf("server rejected request, may cause by invalid credential") + } else { + var resp fiber.Map + if err := json.Unmarshal(data, &resp); err != nil { + return err + } else if resp["server"] != "RoadSign" { + return fmt.Errorf("remote server isn't roadsign") + } else if resp["version"] != roadsign.AppVersion { + log.Warn().Msg("Server connected successfully, but remote server version mismatch than CLI version, some features may buggy or completely unusable.") + } + } + return nil +} diff --git a/pkg/cmd/rds/conn/directory.go b/pkg/cmd/rds/conn/directory.go new file mode 100644 index 0000000..60821b0 --- /dev/null +++ b/pkg/cmd/rds/conn/directory.go @@ -0,0 +1,17 @@ +package conn + +import ( + "encoding/json" + + "github.com/samber/lo" + "github.com/spf13/viper" +) + +func GetConnection(id string) (CliConnection, bool) { + var servers []CliConnection + raw, _ := json.Marshal(viper.Get("servers")) + _ = json.Unmarshal(raw, &servers) + return lo.Find(servers, func(item CliConnection) bool { + return item.ID == id + }) +} diff --git a/pkg/cmd/rds/deploy/commands.go b/pkg/cmd/rds/deploy/commands.go new file mode 100644 index 0000000..9fcf60b --- /dev/null +++ b/pkg/cmd/rds/deploy/commands.go @@ -0,0 +1,85 @@ +package deploy + +import ( + "context" + "fmt" + "os" + "path/filepath" + + "code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/conn" + "github.com/gofiber/fiber/v2" + "github.com/google/uuid" + "github.com/mholt/archiver/v4" + "github.com/rs/zerolog/log" + "github.com/samber/lo" + "github.com/urfave/cli/v2" +) + +var DeployCommands = []*cli.Command{ + { + Name: "deploy", + Aliases: []string{"dp"}, + ArgsUsage: " [path]", + Action: func(ctx *cli.Context) error { + if ctx.Args().Len() < 3 { + return fmt.Errorf("must have three arguments: [path]") + } + + server, ok := conn.GetConnection(ctx.Args().Get(0)) + if !ok { + return fmt.Errorf("server was not found, use \"rds connect\" add one first") + } + + // Prepare file to upload + log.Info().Msg("Preparing file to upload, please stand by...") + + filelist, err := archiver.FilesFromDisk(nil, map[string]string{ + lo.Ternary(ctx.Args().Len() > 3, ctx.Args().Get(4), "."): "", + }) + if err != nil { + return fmt.Errorf("failed to prepare file: %q", err) + } + + workdir, _ := os.Getwd() + filename := filepath.Join(workdir, fmt.Sprintf("rds-deploy-cache-%s.zip", uuid.NewString())) + out, err := os.Create(filename) + if err != nil { + return fmt.Errorf("failed to prepare file: %q", err) + } + defer out.Close() + + if err := (archiver.Zip{}).Archive(context.Background(), out, filelist); err != nil { + return fmt.Errorf("failed to prepare file: %q", err) + } + + // Send request + log.Info().Msg("Now publishing to remote server...") + + url := fmt.Sprintf("/webhooks/publish/%s/%s?mimetype=%s", ctx.Args().Get(1), ctx.Args().Get(2), "application/zip") + client := fiber.Put(server.Url+url). + SendFile(filename, "attachments"). + MultipartForm(nil). + BasicAuth("RoadSign CLI", server.Credential) + + var mistake error + if status, _, err := client.Bytes(); len(err) > 0 { + mistake = fmt.Errorf("failed to publish to remote: %q", err) + } else if status != 200 { + mistake = fmt.Errorf("server rejected request, may cause by invalid credential") + } + + // Cleanup + log.Info().Msg("Cleaning up...") + os.Remove(filename) + + if mistake != nil { + return mistake + } + + // Well done! + log.Info().Msg("Well done! Your site is successfully published! 🎉") + + return nil + }, + }, +} diff --git a/pkg/cmd/rds/main.go b/pkg/cmd/rds/main.go new file mode 100644 index 0000000..775315d --- /dev/null +++ b/pkg/cmd/rds/main.go @@ -0,0 +1,48 @@ +package main + +import ( + "os" + + roadsign "code.smartsheep.studio/goatworks/roadsign/pkg" + "code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/conn" + "code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds/deploy" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" + "github.com/spf13/viper" + "github.com/urfave/cli/v2" +) + +func init() { + zerolog.TimeFieldFormat = zerolog.TimeFormatUnix + log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stdout}) +} + +func main() { + // Configure settings + viper.AddConfigPath("$HOME") + viper.SetConfigName(".roadsignrc") + viper.SetConfigType("yaml") + + // Load settings + if err := viper.ReadInConfig(); err != nil { + if _, ok := err.(viper.ConfigFileNotFoundError); ok { + viper.SafeWriteConfig() + viper.ReadInConfig() + } else { + log.Panic().Err(err).Msg("An error occurred when loading settings.") + } + } + + // Configure CLI + app := &cli.App{ + Name: "RoadSign CLI", + Version: roadsign.AppVersion, + Suggest: true, + Commands: append(append([]*cli.Command{}, conn.CliCommands...), deploy.DeployCommands...), + } + + // Run CLI + if err := app.Run(os.Args); err != nil { + log.Fatal().Err(err).Msg("An error occurred when running cli.") + } +} diff --git a/pkg/filesystem/zip.go b/pkg/filesystem/zip.go index 9e7d75f..47bd6e7 100644 --- a/pkg/filesystem/zip.go +++ b/pkg/filesystem/zip.go @@ -2,11 +2,9 @@ package filesystem import ( "archive/zip" - "fmt" "io" "os" "path/filepath" - "strings" ) func Unzip(src, dest string) error { @@ -35,10 +33,6 @@ func Unzip(src, dest string) error { path := filepath.Join(dest, f.Name) - if !strings.HasPrefix(path, filepath.Clean(dest)+string(os.PathSeparator)) { - return fmt.Errorf("illegal file path: %s", path) - } - if f.FileInfo().IsDir() { _ = os.MkdirAll(path, f.Mode()) } else { diff --git a/pkg/meta.go b/pkg/meta.go index 92290d7..b036dc4 100644 --- a/pkg/meta.go +++ b/pkg/meta.go @@ -1,5 +1,5 @@ package roadsign const ( - AppVersion = "1.0.0" + AppVersion = "1.2.1" ) diff --git a/pkg/sign/pm.go b/pkg/sign/pm.go index d202238..966263b 100644 --- a/pkg/sign/pm.go +++ b/pkg/sign/pm.go @@ -68,5 +68,9 @@ func (v *ProcessConfig) StartProcess() error { } func (v *ProcessConfig) StopProcess() error { - return v.Cmd.Process.Signal(os.Interrupt) + if v.Cmd != nil && v.Cmd.Process != nil { + return v.Cmd.Process.Signal(os.Interrupt) + } else { + return nil + } } diff --git a/test/benchmark/data/.gitignore b/test/benchmark/data/.gitignore index a5410f1..648365f 100644 --- a/test/benchmark/data/.gitignore +++ b/test/benchmark/data/.gitignore @@ -1 +1,2 @@ -/.output \ No newline at end of file +/.output +/.spa \ No newline at end of file diff --git a/test/benchmark/roadsign-spa/config/example.yaml b/test/benchmark/roadsign-spa/config/example.yaml new file mode 100644 index 0000000..0793141 --- /dev/null +++ b/test/benchmark/roadsign-spa/config/example.yaml @@ -0,0 +1,8 @@ +name: Example Site +rules: + - host: ["localhost:8000"] + path: ["/"] +upstreams: + - id: example + name: Benchmarking Data + uri: files://../data/.spa diff --git a/test/benchmark/roadsign-spa/settings.yml b/test/benchmark/roadsign-spa/settings.yml new file mode 100644 index 0000000..07eb04e --- /dev/null +++ b/test/benchmark/roadsign-spa/settings.yml @@ -0,0 +1,26 @@ +debug: + print_routes: false +hypertext: + administration_ports: [":81"] + administration_secured_ports: [] + certificate: + administration_key: ./cert.key + administration_pem: ./cert.pem + key: ./cert.key + pem: ./cert.pem + limitation: + max_body_size: -1 + max_qps: -1 + ports: + - :8000 + secured_ports: [] +paths: + configs: ./config +performance: + request_logging: false + network_timeout: 3000 + prefork: false +security: + administration_trusted_proxies: + - localhost + credential: e81f43f32d934271af6322e5376f5f59 diff --git a/test/benchmark/roadsign-ssr/settings.yml b/test/benchmark/roadsign-ssr/settings.yml index 8e5bdd2..07eb04e 100644 --- a/test/benchmark/roadsign-ssr/settings.yml +++ b/test/benchmark/roadsign-ssr/settings.yml @@ -1,7 +1,7 @@ debug: print_routes: false hypertext: - administration_ports: [] + administration_ports: [":81"] administration_secured_ports: [] certificate: administration_key: ./cert.key diff --git a/test/benchmark/roadsign-with-prefork/settings.yml b/test/benchmark/roadsign-with-prefork/settings.yml index a36620d..c16dc22 100644 --- a/test/benchmark/roadsign-with-prefork/settings.yml +++ b/test/benchmark/roadsign-with-prefork/settings.yml @@ -1,7 +1,7 @@ debug: print_routes: false hypertext: - administration_ports: [] + administration_ports: [":81"] administration_secured_ports: [] certificate: administration_key: ./cert.key diff --git a/test/benchmark/roadsign/settings.yml b/test/benchmark/roadsign/settings.yml index 8e5bdd2..07eb04e 100644 --- a/test/benchmark/roadsign/settings.yml +++ b/test/benchmark/roadsign/settings.yml @@ -1,7 +1,7 @@ debug: print_routes: false hypertext: - administration_ports: [] + administration_ports: [":81"] administration_secured_ports: [] certificate: administration_key: ./cert.key