From acf64b991571b90884cde1874d277911bcda0e76 Mon Sep 17 00:00:00 2001 From: outdead Date: Fri, 10 Jul 2020 04:15:13 +0300 Subject: [PATCH] Fix Conan Exiles response for another request error #6 --- .gitignore | 1 + CHANGELOG.md | 7 ++++++- LICENSE | 2 +- go.mod | 2 +- go.sum | 6 ++++-- main.go | 24 +++++++++++++----------- release.sh | 43 ++++++++++++++++++++++++------------------- 7 files changed, 50 insertions(+), 35 deletions(-) diff --git a/.gitignore b/.gitignore index d25cee4..9a3e32b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build.sh vendor/ Gopkg.lock release/ +logs/ *.log rcon-temp.yaml temp/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fb89f0..ead21c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +## [v0.6.0] - 2020-07-10 +### Fixed +- Fix `Conan Exiles "response for another request" error` bug #6 + ## [v0.5.0] - 2020-06-18 ### Fixed - Correction of text after AutoCorrect @@ -43,7 +47,8 @@ than entry in configuration file. ### Added - Initial implementation. -[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.5.0...HEAD +[Unreleased]: https://github.com/gorcon/rcon-cli/compare/v0.6.0...HEAD +[v0.5.0]: https://github.com/gorcon/rcon-cli/compare/v0.5.0...v0.6.0 [v0.5.0]: https://github.com/gorcon/rcon-cli/compare/v0.4.0...v0.5.0 [v0.4.0]: https://github.com/gorcon/rcon-cli/compare/v0.3.0...v0.4.0 [v0.3.0]: https://github.com/gorcon/rcon-cli/compare/v0.2.0...v0.3.0 diff --git a/LICENSE b/LICENSE index 2aeadac..a5db1e2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Pavel Korotkiy +Copyright (c) 2020 Pavel Korotkiy (outdead) 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/go.mod b/go.mod index 117a4ee..f511309 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.13 require ( github.com/go-yaml/yaml v2.1.0+incompatible - github.com/gorcon/rcon v1.1.2 + github.com/gorcon/rcon v1.2.0 github.com/stretchr/testify v1.6.1 github.com/urfave/cli v1.22.4 ) diff --git a/go.sum b/go.sum index 8b7e0bf..281f118 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,8 @@ 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/go-yaml/yaml v2.1.0+incompatible h1:RYi2hDdss1u4YE7GwixGzWwVo47T8UQwnTLB6vQiq+o= github.com/go-yaml/yaml v2.1.0+incompatible/go.mod h1:w2MrLa16VYP0jy6N7M5kHaCkaLENm+P+Tv+MfurjSw0= -github.com/gorcon/rcon v1.1.2 h1:rXuVvExPoIFSFbqdci/VTluOuksYY0HRxmuzVMV6aLw= -github.com/gorcon/rcon v1.1.2/go.mod h1:PETQ9mPvdT1SSRoX3d4zBpTZdpDZ2m6672czgylgchc= +github.com/gorcon/rcon v1.2.0 h1:g4JOGxZZRab4xtwWnJKErsY3s/V1OR5BfnZ22o0fl88= +github.com/gorcon/rcon v1.2.0/go.mod h1:PETQ9mPvdT1SSRoX3d4zBpTZdpDZ2m6672czgylgchc= 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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= @@ -19,7 +19,9 @@ github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= +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.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go index 2d8df29..902fbb8 100644 --- a/main.go +++ b/main.go @@ -38,6 +38,10 @@ const LogRecordFormat = "[%s] %s: %s\n%s\n\n" // If not specified, no logging will be performed. var LogFileName string +// Version displays service version in semantic versioning (http://semver.org/). +// Can be replaced while compiling with flag `-ldflags "-X main.Version=${VERSION}"` +var Version = "develop" + // Config allows to take a remote server address and password from // the configuration file. This enables not to specify these flags when // running the CLI. @@ -63,14 +67,14 @@ func main() { } } -// NewApp creates a new cli Application +// NewApp creates a new cli Application. func NewApp(r io.Reader, w io.Writer) *cli.App { app := cli.NewApp() app.Usage = "CLI for executing queries on a remote server" app.Description = "Can be run in two modes - in the mode of a single query" + "\n and in the mode of reading the input stream" - app.Version = "0.4.2" - app.Copyright = "Copyright (c) 2019 Pavel Korotkiy (outdead)" + app.Version = Version + app.Copyright = "Copyright (c) 2020 Pavel Korotkiy (outdead)" app.Flags = []cli.Flag{ cli.StringFlag{ Name: "a, address", @@ -112,14 +116,12 @@ func NewApp(r io.Reader, w io.Writer) *cli.App { return Interactive(r, w, address, password) } - if address == "" || password == "" { - if address == "" { - return errors.New("address is not set: to set address add -a host:port") - } + if address == "" { + return errors.New("address is not set: to set address add -a host:port") + } - if password == "" { - return errors.New("password is not set: to set password add -p password") - } + if password == "" { + return errors.New("password is not set: to set password add -p password") } return Execute(w, address, password, command) @@ -173,7 +175,7 @@ func Interactive(r io.Reader, w io.Writer, address string, password string) erro } scanner := bufio.NewScanner(r) - fmt.Fprintf(w, "Waiting commands for %s\n> ", address) + fmt.Fprintf(w, "Waiting commands for %s (or type %s to exit)\n> ", address, CommandQuit) for scanner.Scan() { command := scanner.Text() if command != "" { diff --git a/release.sh b/release.sh index f1aa52b..ad2a0c4 100755 --- a/release.sh +++ b/release.sh @@ -1,6 +1,11 @@ #!/usr/bin/env bash -VER="0.5.0" +VERSION="$1" + +if [ -z "${VERSION}" ]; then + echo "VERSION is not set. Use ./release.sh 0.0.0" >&2 + exit 1 +fi rm -fr release mkdir release @@ -16,33 +21,33 @@ function make_release() { fi local ext="$4" - local dir=release/$release_name + local dir="release/${release_name}" - mkdir -p $dir - env GOARCH=$arch GOOS=$os go build -ldflags "-s -w" -o $dir/rcon$ext - #upx-ucl --best $dir/rcon$ext -o $dir/rcon-upx$ext + mkdir -p "${dir}" + env GOARCH="${arch}" GOOS="${os}" go build -ldflags "-s -w -X main.Version=${VERSION}" -o "${dir}/rcon${ext}" + #upx-ucl --best "${dir}/rcon${ext}" -o "${dir}/rcon-upx${ext}" - cp LICENSE $dir - cp README.md $dir - cp CHANGELOG.md $dir - cp rcon.yaml $dir + cp LICENSE "${dir}" + cp README.md "${dir}" + cp CHANGELOG.md "${dir}" + cp rcon.yaml "${dir}" cd release/ - case $os in + case "${os}" in linux) - tar -zcvf $release_name.tar.gz $release_name - md5sum $release_name.tar.gz >> checksum.txt + tar -zcvf "${release_name}.tar.gz" "${release_name}" + md5sum "${release_name}.tar.gz" >> checksum.txt ;; windows) - zip -r $release_name.zip $release_name - md5sum $release_name.zip >> checksum.txt + zip -r "${release_name}.zip" "${release_name}" + md5sum "${release_name}.zip" >> checksum.txt ;; esac - rm -r $release_name + rm -r "${release_name}" cd ../ } -make_release 386 linux rcon-$VER-i386_linux -make_release amd64 linux rcon-$VER-amd64_linux -make_release 386 windows rcon-$VER-win32 .exe -make_release amd64 windows rcon-$VER-win64 .exe +make_release 386 linux "rcon-${VERSION}-i386_linux" +make_release amd64 linux "rcon-${VERSION}-amd64_linux" +make_release 386 windows "rcon-${VERSION}-win32" .exe +make_release amd64 windows "rcon-${VERSION}-win64" .exe