mirror of https://github.com/icedream/icecon.git
Compare commits
No commits in common. "develop" and "v1.0.0" have entirely different histories.
|
@ -1,33 +0,0 @@
|
||||||
# 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/*
|
|
|
@ -1,46 +0,0 @@
|
||||||
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 }}
|
|
|
@ -1,22 +0,0 @@
|
||||||
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,7 +2,6 @@
|
||||||
*.o
|
*.o
|
||||||
*.a
|
*.a
|
||||||
*.so
|
*.so
|
||||||
*.syso
|
|
||||||
|
|
||||||
# Folders
|
# Folders
|
||||||
_obj
|
_obj
|
||||||
|
|
26
CHANGELOG.md
26
CHANGELOG.md
|
@ -1,26 +0,0 @@
|
||||||
# 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
|
|
17
Dockerfile
17
Dockerfile
|
@ -1,17 +0,0 @@
|
||||||
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"]
|
|
|
@ -1,107 +0,0 @@
|
||||||
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,23 +1,14 @@
|
||||||
#  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 but it [is also officially supported for use with FiveM servers](https://forum.cfx.re/t/release-icecon-the-officially-supported-rcon-tool/7558).
|
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.
|
||||||
|
|
||||||
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 for all releases for Linux and Windows are always available on the [GitHub releases page](https://github.com/icedream/icecon/releases).
|
Binaries will be provided as soon as possible, both stable and snapshots!
|
||||||
|
|
||||||
### Source code
|
### Source code
|
||||||
|
|
||||||
|
|
12
go.mod
12
go.mod
|
@ -1,12 +0,0 @@
|
||||||
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
|
|
||||||
)
|
|
37
go.sum
37
go.sum
|
@ -1,37 +0,0 @@
|
||||||
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=
|
|
BIN
img/logo_32.png
BIN
img/logo_32.png
Binary file not shown.
Before Width: | Height: | Size: 369 B |
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
14
main.go
14
main.go
|
@ -10,8 +10,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/alecthomas/kingpin/v2"
|
"github.com/icedream/go-q3net"
|
||||||
quake "github.com/icedream/go-q3net"
|
"gopkg.in/alecthomas/kingpin.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -22,9 +22,8 @@ var (
|
||||||
"Server IP/hostname and port, written as \"server:port\".")
|
"Server IP/hostname and port, written as \"server:port\".")
|
||||||
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
|
||||||
socketBuffer = make([]byte, 64*1024)
|
socketBuffer = make([]byte, 64*1024)
|
||||||
|
@ -40,7 +39,7 @@ func initSocketAddr(addr string) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
address, addressStr = newAddr, addr
|
address = newAddr
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -117,7 +116,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-2023 Carl Kittelberger/Icedream")
|
fmt.Println("\t\u00A9 2016 Carl Kittelberger/Icedream")
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
|
|
||||||
argAddressTCP := argAddress.TCP()
|
argAddressTCP := argAddress.TCP()
|
||||||
|
@ -182,6 +181,7 @@ func main() {
|
||||||
if socket != nil {
|
if socket != nil {
|
||||||
socket.Close()
|
socket.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func runConsoleShell() {
|
func runConsoleShell() {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
//go:build windows
|
//+build windows
|
||||||
// +build windows
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -11,8 +10,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,11 +25,7 @@ var (
|
||||||
kernel32 *syscall.DLL
|
kernel32 *syscall.DLL
|
||||||
freeConsole *syscall.Proc
|
freeConsole *syscall.Proc
|
||||||
|
|
||||||
dlg *mainDialog
|
dlg *mainDialog
|
||||||
dlgOriginalTitle string
|
|
||||||
|
|
||||||
history []string
|
|
||||||
historyIndex = 0
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -64,27 +59,6 @@ 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 {
|
||||||
|
@ -94,7 +68,7 @@ func runGraphicalUi() (err error) {
|
||||||
|
|
||||||
// Window icon
|
// Window icon
|
||||||
// TODO - Do this more intelligently
|
// TODO - Do this more intelligently
|
||||||
for i := 0; i < 128; i++ {
|
for i := uintptr(0); i < uintptr(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
|
||||||
|
@ -117,6 +91,10 @@ 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))
|
||||||
|
@ -129,7 +107,6 @@ 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 {
|
||||||
|
@ -138,31 +115,6 @@ 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
|
||||||
}
|
}
|
||||||
|
@ -177,16 +129,11 @@ 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()
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build windows,386
|
//+build windows
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
Binary file not shown.
|
@ -1,5 +0,0 @@
|
||||||
// +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": 1,
|
"Patch": 0,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"ProductVersion": {
|
"ProductVersion": {
|
||||||
"Major": 1,
|
"Major": 1,
|
||||||
"Minor": 0,
|
"Minor": 0,
|
||||||
"Patch": 1,
|
"Patch": 0,
|
||||||
"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.1.0",
|
"FileVersion": "1.0.0.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.1.0",
|
"ProductVersion": "1.0.0.0",
|
||||||
"SpecialBuild": ""
|
"SpecialBuild": ""
|
||||||
},
|
},
|
||||||
"VarFileInfo":
|
"VarFileInfo":
|
||||||
|
|
Loading…
Reference in New Issue