mirror of https://github.com/icedream/icecon.git
Compare commits
70 Commits
Author | SHA1 | Date |
---|---|---|
|
a6481c8847 | |
|
e3fb41f2b1 | |
|
5cb0ecfc00 | |
|
2f881a0a80 | |
|
0ed007f423 | |
|
324c0d703d | |
|
0ea473d7ea | |
|
d1144ee37a | |
|
9bbf1f78fd | |
|
07dd58b086 | |
|
09530afe91 | |
|
e305e0107b | |
|
f5e4a2e150 | |
|
7387bb9f96 | |
|
dbd578561d | |
|
028cf027ac | |
|
b114b440d3 | |
|
19b906da47 | |
|
45f22fed96 | |
|
d2ceedf2b9 | |
|
13cbce865a | |
|
905790d645 | |
|
0c17a8c35a | |
|
f375a025ea | |
|
d84c18c997 | |
|
4f960bb81e | |
|
0e788c4b73 | |
|
5f38517277 | |
|
e327325b27 | |
|
ec97251317 | |
|
b905774d9d | |
|
0c690d86c2 | |
|
028041236e | |
|
bd8f873d02 | |
|
07693583fe | |
|
678ba5fc50 | |
|
0fa211594f | |
|
8984196fd1 | |
|
2669400bb1 | |
|
3b676092d8 | |
|
57d2cb92da | |
|
9e86bae2d9 | |
|
38c158778a | |
|
e68f46fcfc | |
|
f373428ec4 | |
|
46eab3a322 | |
|
cb9facd9cc | |
|
d11db9738f | |
|
06af870346 | |
|
6d22fbee2b | |
|
d38e6e10c0 | |
|
ce4ab02bf4 | |
|
508b5d461e | |
|
48f1ab5f16 | |
|
12224a9ae3 | |
|
15c418e9b6 | |
|
6f7b4daa7e | |
|
f148c09563 | |
|
11201d12c9 | |
|
cb55b85a14 | |
|
a2895609ed | |
|
61a2f9ce74 | |
|
8d7e33545a | |
|
9e6e209eb4 | |
|
26bd990227 | |
|
4011bce29b | |
|
655d7cb094 | |
|
d7c14fd3b7 | |
|
6e08fe8ba6 | |
|
b5af05e6d0 |
|
@ -0,0 +1,33 @@
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
*.syso
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
*.exe
|
||||||
|
*.test
|
||||||
|
*.prof
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
*Docker*
|
||||||
|
*.docker*
|
||||||
|
|
||||||
|
#Jenkinsfile
|
||||||
|
#.github/*
|
|
@ -0,0 +1,46 @@
|
||||||
|
name: Docker image build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
-
|
||||||
|
name: Check out the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
#-
|
||||||
|
# name: Log in to DockerHub
|
||||||
|
# uses: docker/login-action@v1
|
||||||
|
# with:
|
||||||
|
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Log in to GitHub container registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
-
|
||||||
|
name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Go
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- name: Set up Go 1.21
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: 1.21
|
||||||
|
id: go
|
||||||
|
|
||||||
|
- name: Check out code into the Go module directory
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: go build -v .
|
|
@ -2,6 +2,7 @@
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
*.so
|
*.so
|
||||||
|
*.syso
|
||||||
|
|
||||||
# Folders
|
# Folders
|
||||||
_obj
|
_obj
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Change Log
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Up and down arrow keys can now be used to scroll through command history to reissue already typed commands. (Windows UI) ([#10](https://github.com/icedream/icecon/pull/10), thanks to @TheIndra55)
|
||||||
|
- Current server address in title bar. (Windows UI)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Binaries are now compiled statically and using Go 1.18.
|
||||||
|
- Reuse server address as typed in by the user in connect dialog instead of using resolved IP address. (Windows UI)
|
||||||
|
- Update copyright text.
|
||||||
|
- Update several dependencies, including yaml.v2 to fix potential looping resource hog (https://github.com/icedream/icecon/security/dependabot/1).
|
||||||
|
|
||||||
|
## [1.0.0] - 2016-05-07
|
||||||
|
### Added
|
||||||
|
- Add fully working command line flags, see the help text that can be called by running IceCon with `--help` in a console
|
||||||
|
- Add graphical UI for Windows (`--gui` or automatically shown when run without parameters)
|
||||||
|
- Add netcat-style console interface (can be used like netcat to pipe through commands)
|
||||||
|
- Add script-friendly command line interface (`icecon -c <your command here> <server:port> <password>`)
|
||||||
|
|
||||||
|
[Unreleased]: https://github.com/icedream/icecon/compare/v1.0.0...develop
|
||||||
|
[1.0.0]: https://github.com/icedream/icecon/releases/tag/v1.0.0
|
|
@ -0,0 +1,17 @@
|
||||||
|
FROM golang:1.22-alpine AS build
|
||||||
|
|
||||||
|
WORKDIR /usr/src/icecon
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY * .
|
||||||
|
RUN go generate -v ./...
|
||||||
|
RUN go build -v -ldflags "-s -w" .
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
COPY --from=build /usr/src/icecon/icecon /usr/local/bin
|
||||||
|
|
||||||
|
STOPSIGNAL SIGTERM
|
||||||
|
ENTRYPOINT ["/usr/local/bin/icecon"]
|
|
@ -0,0 +1,107 @@
|
||||||
|
def binext(os) {
|
||||||
|
switch(os) {
|
||||||
|
case "windows":
|
||||||
|
return ".exe"
|
||||||
|
default:
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def upx(file) {
|
||||||
|
// Install upx
|
||||||
|
switch("${env.GOOS}.${env.GOARCH}") {
|
||||||
|
case "linux.amd64":
|
||||||
|
case "linux.386":
|
||||||
|
case "darwin.amd64":
|
||||||
|
case "darwin.arm":
|
||||||
|
case "windows.amd64":
|
||||||
|
case "windows.386":
|
||||||
|
case "freebsd.386":
|
||||||
|
case "netbsd.386":
|
||||||
|
withEnv(["PATH+=${tool "UPX v3.91"}"]) {
|
||||||
|
if (env.GOOS == "linux") {
|
||||||
|
sh "GOOS= GOARCH= go get -v github.com/pwaller/goupx"
|
||||||
|
sh "goupx --no-upx \"$file\""
|
||||||
|
}
|
||||||
|
sh "upx --best --ultra-brute \"$file\""
|
||||||
|
}
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
echo "Skipping UPX compression as it is not supported for $goos/$goarch."
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def withGoEnv(os, arch, f) {
|
||||||
|
// Install go
|
||||||
|
env.GOROOT = tool "Go 1.8"
|
||||||
|
|
||||||
|
switch(arch) {
|
||||||
|
case "x64":
|
||||||
|
arch = "amd64"
|
||||||
|
break
|
||||||
|
case "x86":
|
||||||
|
arch = "386"
|
||||||
|
break
|
||||||
|
case "armv5":
|
||||||
|
case "armv6":
|
||||||
|
case "armv7":
|
||||||
|
arch = "arm"
|
||||||
|
break
|
||||||
|
case "armv8":
|
||||||
|
arch = "arm64"
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
withEnv([
|
||||||
|
"CGO_ENABLED=1",
|
||||||
|
"GOARCH=${arch}",
|
||||||
|
"GOOS=${os}",
|
||||||
|
"GOPATH=${env.WORKSPACE}/.go",
|
||||||
|
"PATH+=${env.GOROOT}/bin:${env.WORKSPACE}/.go/bin",
|
||||||
|
]) {
|
||||||
|
switch(arch) {
|
||||||
|
case "armv5":
|
||||||
|
withEnv("GOARM=5", f)
|
||||||
|
break
|
||||||
|
case "armv6":
|
||||||
|
withEnv("GOARM=6", f)
|
||||||
|
break
|
||||||
|
case "armv7":
|
||||||
|
withEnv("GOARM=7", f)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
f()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def build(os, arch) {
|
||||||
|
node("docker && linux && amd64") {
|
||||||
|
checkout scm
|
||||||
|
docker.image("dockcross/${os}-${arch}").inside {
|
||||||
|
withGoEnv(os, arch) {
|
||||||
|
def binfilename = "icecon_${env.GOOS}_${env.GOARCH}${binext os}"
|
||||||
|
sh """
|
||||||
|
GOOS= GOARCH= go get -v \
|
||||||
|
github.com/josephspurrier/goversioninfo/cmd/goversioninfo \
|
||||||
|
github.com/icedream/ui2walk \
|
||||||
|
"""
|
||||||
|
sh "go generate -v ./..."
|
||||||
|
sh "go get -v -d ./..."
|
||||||
|
sh "go build -v -ldflags -s -o ${binfilename}"
|
||||||
|
upx binfilename
|
||||||
|
archive "${binfilename}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
parallel (
|
||||||
|
windows_x64: { build("windows", "x64") },
|
||||||
|
windows_x86: { build("windows", "x86") },
|
||||||
|
linux_x64: { build("linux", "x64") },
|
||||||
|
linux_x86: { build("linux", "x86") },
|
||||||
|
linux_arm: { build("linux", "armv5") }
|
||||||
|
)
|
15
README.md
15
README.md
|
@ -1,14 +1,23 @@
|
||||||
# IceCon RCON client
|
#  IceCon RCON client
|
||||||
|
|
||||||
|
[](https://github.com/icedream/icecon/releases)
|
||||||
|

|
||||||
|
|
||||||
*IceCon* is a Q3-compatible RCON client. It can connect to any server that implements RCON over a Q3-compatible network protocol (UDP) and even comes with a nice, straight minimal GUI.
|
*IceCon* is a Q3-compatible RCON client. It can connect to any server that implements RCON over a Q3-compatible network protocol (UDP) and even comes with a nice, straight minimal GUI.
|
||||||
|
|
||||||
Specifically, this tool has been written for quick administration of modified Modern Warfare 2 ("IW4M") servers. A Windows user could easily set up shortcuts on the desktop that run `icecon.exe -gui <server:port> <password>` which gives you an instant GUI to run commands on your server. Another use case would be scripting on a Linux server by running `icecon -command "<your command here>" <server:port> <password>` to automate specific tasks.
|
Specifically, this tool has been written for quick administration of modified Modern Warfare 2 ("IW4M") servers but it [is also officially supported for use with FiveM servers](https://forum.cfx.re/t/release-icecon-the-officially-supported-rcon-tool/7558).
|
||||||
|
|
||||||
|
A Windows user could easily set up shortcuts on the desktop that run `icecon.exe -gui <server:port> <password>` which gives you an instant GUI to run commands on your server. Another use case would be scripting on a Linux server by running `icecon -command "<your command here>" <server:port> <password>` to automate specific tasks.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
|
|
||||||
### Binaries
|
### Binaries
|
||||||
|
|
||||||
Binaries will be provided as soon as possible, both stable and snapshots!
|
Binaries for all releases for Linux and Windows are always available on the [GitHub releases page](https://github.com/icedream/icecon/releases).
|
||||||
|
|
||||||
### Source code
|
### Source code
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
module github.com/icedream/icecon
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/alecthomas/kingpin/v2 v2.4.0
|
||||||
|
github.com/icedream/go-q3net v0.1.0
|
||||||
|
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
|
||||||
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e // indirect
|
||||||
|
golang.org/x/sys v0.12.0 // indirect
|
||||||
|
gopkg.in/Knetic/govaluate.v3 v3.0.0 // indirect
|
||||||
|
)
|
|
@ -0,0 +1,37 @@
|
||||||
|
github.com/alecthomas/kingpin/v2 v2.4.0 h1:f48lwail6p8zpO1bC4TxtqACaGqHYA22qkHjHpqDjYY=
|
||||||
|
github.com/alecthomas/kingpin/v2 v2.4.0/go.mod h1:0gyi0zQnjuFk8xrkNKamJoyUo382HRL7ATRpFZCw6tE=
|
||||||
|
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
|
||||||
|
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
|
||||||
|
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/icedream/go-q3net v0.1.0 h1:ly5QS55sXAs7HunlCPDsUmS6QLYqP6kGBdupwufaiC4=
|
||||||
|
github.com/icedream/go-q3net v0.1.0/go.mod h1:2Y0epYeaR6uWXDMvapfsUkLDqAXhI8mp/J5LxO86eUU=
|
||||||
|
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794 h1:NVRJ0Uy0SOFcXSKLsS65OmI1sgCCfiDUPj+cwnH7GZw=
|
||||||
|
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794/go.mod h1:E23UucZGqpuUANJooIbHWCufXvOcT6E7Stq81gU+CSQ=
|
||||||
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e h1:H+t6A/QJMbhCSEH5rAuRxh+CtW96g0Or0Fxa9IKr4uc=
|
||||||
|
github.com/lxn/win v0.0.0-20210218163916-a377121e959e/go.mod h1:KxxjdtRkfNoYDCUP5ryK7XJJNTnpC8atvtmTheChOtk=
|
||||||
|
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/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
|
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||||
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
|
github.com/xhit/go-str2duration/v2 v2.1.0 h1:lxklc02Drh6ynqX+DdPyp5pCKLUQpRT8bp8Ydu2Bstc=
|
||||||
|
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||||
|
golang.org/x/sys v0.0.0-20201018230417-eeed37f84f13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||||
|
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
gopkg.in/Knetic/govaluate.v3 v3.0.0 h1:18mUyIt4ZlRlFZAAfVetz4/rzlJs9yhN+U02F4u1AOc=
|
||||||
|
gopkg.in/Knetic/govaluate.v3 v3.0.0/go.mod h1:csKLBORsPbafmSCGTEh3U7Ozmsuq8ZSIlKk1bcqph0E=
|
||||||
|
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/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
Binary file not shown.
After Width: | Height: | Size: 369 B |
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
10
main.go
10
main.go
|
@ -10,8 +10,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/icedream/go-q3net"
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"gopkg.in/alecthomas/kingpin.v2"
|
quake "github.com/icedream/go-q3net"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -23,6 +23,7 @@ var (
|
||||||
argPassword = kingpin.Arg("password", "The RCON password.")
|
argPassword = kingpin.Arg("password", "The RCON password.")
|
||||||
|
|
||||||
address *net.UDPAddr
|
address *net.UDPAddr
|
||||||
|
addressStr string
|
||||||
password string
|
password string
|
||||||
|
|
||||||
socket *net.UDPConn
|
socket *net.UDPConn
|
||||||
|
@ -39,7 +40,7 @@ func initSocketAddr(addr string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
address = newAddr
|
address, addressStr = newAddr, addr
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -116,7 +117,7 @@ func usage() {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("IceCon - Icedream's RCON Client")
|
fmt.Println("IceCon - Icedream's RCON Client")
|
||||||
fmt.Println("\t\u00A9 2016 Carl Kittelberger/Icedream")
|
fmt.Println("\t\u00A9 2016-2023 Carl Kittelberger/Icedream")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
argAddressTCP := argAddress.TCP()
|
argAddressTCP := argAddress.TCP()
|
||||||
|
@ -181,7 +182,6 @@ func main() {
|
||||||
if socket != nil {
|
if socket != nil {
|
||||||
socket.Close()
|
socket.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func runConsoleShell() {
|
func runConsoleShell() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
//+build windows
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -10,8 +11,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/alecthomas/kingpin/v2"
|
||||||
"github.com/lxn/walk"
|
"github.com/lxn/walk"
|
||||||
"gopkg.in/alecthomas/kingpin.v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -26,6 +27,10 @@ var (
|
||||||
freeConsole *syscall.Proc
|
freeConsole *syscall.Proc
|
||||||
|
|
||||||
dlg *mainDialog
|
dlg *mainDialog
|
||||||
|
dlgOriginalTitle string
|
||||||
|
|
||||||
|
history []string
|
||||||
|
historyIndex = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -59,6 +64,27 @@ func uiNormalize(textRef *string) {
|
||||||
*textRef = text
|
*textRef = text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func uiUpdateAddress() {
|
||||||
|
if len(dlgOriginalTitle) <= 0 {
|
||||||
|
dlgOriginalTitle = dlg.Title()
|
||||||
|
}
|
||||||
|
if len(addressStr) > 0 {
|
||||||
|
dlg.SetTitle(dlgOriginalTitle + " - " + addressStr)
|
||||||
|
} else {
|
||||||
|
dlg.SetTitle(dlgOriginalTitle)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func addToHistory(command string) {
|
||||||
|
// limit history to 20 items
|
||||||
|
if len(history) > 20 {
|
||||||
|
history = append(history[:0], history[0+1:]...)
|
||||||
|
}
|
||||||
|
|
||||||
|
history = append(history, command)
|
||||||
|
historyIndex = len(history)
|
||||||
|
}
|
||||||
|
|
||||||
func runGraphicalUi() (err error) {
|
func runGraphicalUi() (err error) {
|
||||||
dlg = new(mainDialog)
|
dlg = new(mainDialog)
|
||||||
if err := dlg.init(); err != nil {
|
if err := dlg.init(); err != nil {
|
||||||
|
@ -68,7 +94,7 @@ func runGraphicalUi() (err error) {
|
||||||
|
|
||||||
// Window icon
|
// Window icon
|
||||||
// TODO - Do this more intelligently
|
// TODO - Do this more intelligently
|
||||||
for i := uintptr(0); i < uintptr(128); i++ {
|
for i := 0; i < 128; i++ {
|
||||||
if icon, err := walk.NewIconFromResourceId(i); err == nil {
|
if icon, err := walk.NewIconFromResourceId(i); err == nil {
|
||||||
dlg.SetIcon(icon)
|
dlg.SetIcon(icon)
|
||||||
break
|
break
|
||||||
|
@ -91,10 +117,6 @@ func runGraphicalUi() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
connectAction.Triggered().Attach(func() {
|
connectAction.Triggered().Attach(func() {
|
||||||
addressStr := ""
|
|
||||||
if address != nil {
|
|
||||||
addressStr = address.String()
|
|
||||||
}
|
|
||||||
result, addr, pw, err := runConnectDialog(addressStr, password, dlg)
|
result, addr, pw, err := runConnectDialog(addressStr, password, dlg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
uiLogError(fmt.Sprintf("Failed to run connect dialog: %s", err))
|
uiLogError(fmt.Sprintf("Failed to run connect dialog: %s", err))
|
||||||
|
@ -107,6 +129,7 @@ func runGraphicalUi() (err error) {
|
||||||
}
|
}
|
||||||
password = pw
|
password = pw
|
||||||
dlg.ui.rconOutput.SetText("")
|
dlg.ui.rconOutput.SetText("")
|
||||||
|
uiUpdateAddress()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if err = dlg.Menu().Actions().Add(connectAction); err != nil {
|
if err = dlg.Menu().Actions().Add(connectAction); err != nil {
|
||||||
|
@ -115,6 +138,31 @@ func runGraphicalUi() (err error) {
|
||||||
|
|
||||||
// Handle input
|
// Handle input
|
||||||
dlg.ui.rconInput.KeyPress().Attach(func(key walk.Key) {
|
dlg.ui.rconInput.KeyPress().Attach(func(key walk.Key) {
|
||||||
|
// handle history (arrow up/down)
|
||||||
|
if key == walk.KeyUp || key == walk.KeyDown {
|
||||||
|
if len(history) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if key == walk.KeyUp {
|
||||||
|
if historyIndex == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
historyIndex -= 1
|
||||||
|
dlg.ui.rconInput.SetText(history[historyIndex])
|
||||||
|
} else {
|
||||||
|
if (historyIndex + 1) >= len(history) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
historyIndex += 1
|
||||||
|
dlg.ui.rconInput.SetText(history[historyIndex])
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if key != walk.KeyReturn {
|
if key != walk.KeyReturn {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -129,11 +177,16 @@ func runGraphicalUi() (err error) {
|
||||||
|
|
||||||
uiLog(address.String() + "> " + cmd)
|
uiLog(address.String() + "> " + cmd)
|
||||||
sendRcon(cmd)
|
sendRcon(cmd)
|
||||||
|
|
||||||
|
// add to history
|
||||||
|
addToHistory(cmd)
|
||||||
})
|
})
|
||||||
|
|
||||||
// When window is initialized we can let a secondary routine print all
|
// When window is initialized we can let a secondary routine print all
|
||||||
// output received
|
// output received
|
||||||
dlg.Synchronize(func() {
|
dlg.Synchronize(func() {
|
||||||
|
uiUpdateAddress()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
msg, err := receiveRcon()
|
msg, err := receiveRcon()
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": [
|
||||||
|
"config:base"
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
//+build windows
|
// +build windows,386
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
// +build windows,amd64
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
//go:generate goversioninfo -manifest "rsrc/app.manifest" -icon "rsrc/app.ico" -o "rsrc_windows.syso" -64
|
|
@ -4,13 +4,13 @@
|
||||||
"FileVersion": {
|
"FileVersion": {
|
||||||
"Major": 1,
|
"Major": 1,
|
||||||
"Minor": 0,
|
"Minor": 0,
|
||||||
"Patch": 0,
|
"Patch": 1,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"ProductVersion": {
|
"ProductVersion": {
|
||||||
"Major": 1,
|
"Major": 1,
|
||||||
"Minor": 0,
|
"Minor": 0,
|
||||||
"Patch": 0,
|
"Patch": 1,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"FileFlagsMask": "3f",
|
"FileFlagsMask": "3f",
|
||||||
|
@ -24,14 +24,14 @@
|
||||||
"Comments": "IceCon",
|
"Comments": "IceCon",
|
||||||
"CompanyName": "",
|
"CompanyName": "",
|
||||||
"FileDescription": "Icedream's RCON client",
|
"FileDescription": "Icedream's RCON client",
|
||||||
"FileVersion": "1.0.0.0",
|
"FileVersion": "1.0.1.0",
|
||||||
"InternalName": "icecon",
|
"InternalName": "icecon",
|
||||||
"LegalCopyright": "",
|
"LegalCopyright": "",
|
||||||
"LegalTrademarks": "",
|
"LegalTrademarks": "",
|
||||||
"OriginalFilename": "icecon.exe",
|
"OriginalFilename": "icecon.exe",
|
||||||
"PrivateBuild": "1",
|
"PrivateBuild": "1",
|
||||||
"ProductName": "IceCon",
|
"ProductName": "IceCon",
|
||||||
"ProductVersion": "1.0.0.0",
|
"ProductVersion": "1.0.1.0",
|
||||||
"SpecialBuild": ""
|
"SpecialBuild": ""
|
||||||
},
|
},
|
||||||
"VarFileInfo":
|
"VarFileInfo":
|
||||||
|
|
Loading…
Reference in New Issue