Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.7.0 #89

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
474c1b2
Update: Go from 1.22 to 1.23
luskaner Dec 16, 2024
3a4eb89
Update: updated math/rand usage to math/rand/v2
luskaner Dec 16, 2024
2aebea7
Enhancement: use unsafe version of set for better performance
luskaner Dec 16, 2024
34cd792
Enhancement: remove custom SafeSet implementation replaced by the alr…
luskaner Dec 16, 2024
b71b358
Enhancement: replaced ordered set implementation for one more mantain…
luskaner Dec 17, 2024
fa07eb5
remove toolchain from server go.mod
luskaner Dec 17, 2024
c9e9ac7
simplified some for loops
luskaner Dec 17, 2024
5a895ee
Change: remove Arm32 architecture for Windows (server) as it never wo…
luskaner Dec 18, 2024
67fd0e5
main merge
luskaner Dec 19, 2024
f1f2a9a
fix: previous change of ordered map library caused an error to load s…
luskaner Dec 19, 2024
c6fb22d
Enhancement: windows now use named pipes for IPC instead of unix sock…
luskaner Dec 19, 2024
e0dfca6
Added TODO comment to implement natively the check if game is install…
luskaner Dec 20, 2024
d6848bc
merge
luskaner Dec 20, 2024
145f27d
Enhancement: Remove specific windows 10 version for launcher as now w…
luskaner Dec 20, 2024
cb63c1a
Enhancement: Launcher re-generate certificate if expired or less than…
luskaner Dec 21, 2024
e1683d3
Merge branch 'main' into v1.7.0
luskaner Jan 5, 2025
d1c05aa
Update README.md
luskaner Jan 5, 2025
da45e99
Server: update dependencies
luskaner Jan 5, 2025
23b1707
Merge branch 'main' into v1.7.0
luskaner Jan 7, 2025
b3aac2b
Merge branch 'main' into v1.7.0
luskaner Jan 21, 2025
fd3ff52
Server: fix improperly merged file
luskaner Jan 21, 2025
04776b9
Server: fix (yet another) improperly merged file
luskaner Jan 21, 2025
a314926
Merge branch 'main' into v1.7.0
luskaner Jan 22, 2025
e2d9a39
Cleanup and new iterator refactor
luskaner Jan 22, 2025
6ad9eb6
Updated server requirements to include more windows 10-based editions…
luskaner Jan 23, 2025
a6b053b
Updated server requirements to include more windows 10-based editions…
luskaner Jan 23, 2025
55cf18a
Updated server requirements to include more windows 10-based editions…
luskaner Jan 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '~1.22.0'
go-version: '~1.23.0'
cache-dependency-path: |
common/go.sum
server/go.sum
Expand Down
7 changes: 2 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ builds:
main: ./server
binary: server
goos: [ windows ]
goarch: [ "386", arm ]
goarm: [ "7" ]
goarch: [ "386" ]
- id: server_32_linux
main: ./server
binary: server
Expand Down Expand Up @@ -63,9 +62,8 @@ builds:
main: ./server-genCert
binary: bin/genCert
goos: [ windows ]
goarch: [ "386", arm ]
goarch: [ "386" ]
goamd64: [ "v1" ]
goarm: [ "7" ]
- id: server-genCert_32_linux
main: ./server-genCert
binary: bin/genCert
Expand Down Expand Up @@ -474,7 +472,6 @@ archives:
{{- .RawVersion }}_win
{{- if eq .Arch "386" }}_x86-32
{{- else if eq .Arch "amd64" }}_x86-64
{{- else if eq .Arch "arm" }}_arm32
{{- else if eq .Arch "arm64" }}_arm64
{{- end }}
files:
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Copy `go.work.example` to `go.work`
### System requirements

- OS requirements correspond to the server/launcher ones. Cross-compilation works on all out-the-box.
- [Go 1.22](https://go.dev/dl/).
- [Go 1.23](https://go.dev/dl/).
- [Git](https://git-scm.com/downloads).
- [Task](https://taskfile.dev/installation/).
- [GoReleaser](https://goreleaser.com/).
Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Supported games:
connected to
the internet and Steam or Xbox Live, depending on the platform and version, to fully play offline.**

⚠️ **Repository is now on maintenance only due to lack of contributions/funding and having completed the main goals. Expect only updates to fix bugs and for dependencies/compiler.**
⚠️ **Repository is now on maintenance only due to lack of contributions/funding and having completed the main goals.
Expect only updates to fix bugs and for dependencies/compiler.**

ℹ️ My other [project](https://github.com/luskaner/ageLANServerLauncherCompanion) provides the files and information
to download a Steam Emulator and play 100% offline.
Expand Down Expand Up @@ -113,11 +114,13 @@ in [Questions and Answers (QA)](https://github.com/luskaner/ageLANServer/wiki/Qu

#### Stable

- Windows 10 (no S edition/mode).
- Windows Server 2016.
- Windows IoT.
- Windows:
- 10 (no S edition/mode).
- (Storage) Server 2016.
- IoT (no Arm32).
- Server IoT 2019.
- Linux: kernel 2.6.32 (see [here](https://go.dev/wiki/Linux) for more details).
- macOS: Catalina (v10.15).
- macOS: Big Sur (v11).

Admin rights or firewall permission to listen on port 443 (https) will likely be required depending on the operating
system.
Expand All @@ -129,14 +132,14 @@ system.
- Solaris-based (Solaris and Illumos).
- AIX.

Note: For the full list see [minimum requirements for Go](https://go.dev/wiki/MinimumRequirements) 1.22.
Note: For the full list see [minimum requirements for Go](https://go.dev/wiki/MinimumRequirements) 1.23.

</details>

### Launcher

- Windows (no S edition/mode):
- 10 (1803 - Redstone 5) on x86-64 (recommended).
- 10 on x86-64 (recommended).
- 11 on ARM.
- Linux: *recent* distribution with Steam on x86-64 using Steam Play.

Expand Down Expand Up @@ -184,9 +187,8 @@ supported operating systems.
* **ARM64**: ...\_launcher\_*A.B.C*_linux_arm64.tar.xz
* Server:
* Windows:
* **10, Server 2025 or IoT on ARM64**: ...\_server\_*A.B.C*_win_arm64.zip
* **10 IoT on ARM32**: ...\_server\_*A.B.C*_win_arm32.zip
* **10, Server 2016 or IoT on x86-64**: ...\_server\_*A.B.C*_win_x86-64.zip
* **10, Server (IoT) 2025 or IoT on ARM64**: ...\_server\_*A.B.C*_win_arm64.zip
* **10, (Storage) Server 2016, Server IoT 2019 or IoT on x86-64**: ...\_server\_*A.B.C*_win_x86-64.zip
* **10 or 10 IoT on x86-32**: ...\_server\_*A.B.C*_win_x86-32.zip
* Linux:
* Kernel 3.1 on **ARM64**: ...\_server\_*A.B.C*_linux_arm64.tar.xz
Expand Down
16 changes: 9 additions & 7 deletions common/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ func CertificatePairFolder(executablePath string) string {
return folder
}

func HasCertificatePair(executablePath string) bool {
parentDir := CertificatePairFolder(executablePath)
func CertificatePair(executablePath string) (ok bool, parentDir string, cert string) {
parentDir = CertificatePairFolder(executablePath)
if parentDir == "" {
return false
return
}
if _, err := os.Stat(filepath.Join(parentDir, Cert)); os.IsNotExist(err) {
return false
cert = filepath.Join(parentDir, Cert)
if _, err := os.Stat(cert); os.IsNotExist(err) {
return
}
if _, err := os.Stat(filepath.Join(parentDir, Key)); os.IsNotExist(err) {
return false
return
}
return true
ok = true
return
}
2 changes: 1 addition & 1 deletion common/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const (
GameAoE3 = "age3"
)

var SupportedGames = mapset.NewSet[string](GameAoE1, GameAoE2, GameAoE3)
var SupportedGames = mapset.NewThreadUnsafeSet[string](GameAoE1, GameAoE2, GameAoE3)
2 changes: 1 addition & 1 deletion common/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/luskaner/ageLANServer/common

go 1.22.0
go 1.23.0

require (
github.com/deckarep/golang-set/v2 v2.7.0
Expand Down
2 changes: 1 addition & 1 deletion common/process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func Kill(exe string) (proc *os.Process, err error) {
}

func GameProcesses(gameId string, steam bool, xbox bool) []string {
processes := mapset.NewSet[string]()
processes := mapset.NewThreadUnsafeSet[string]()
if steam {
processes.Add(steamProcess(gameId))
}
Expand Down
7 changes: 3 additions & 4 deletions common/process/process_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"mvdan.cc/sh/v3/shell"
"os"
"path/filepath"
"slices"
"strconv"
)

Expand All @@ -32,10 +33,8 @@ func ProcessesPID(names []string) map[string]uint32 {
continue
}
cmdlineName := filepath.Base(args[0])
for _, name := range names {
if cmdlineName == name {
processesPid[name] = uint32(pid)
}
if slices.Contains(names, cmdlineName) {
processesPid[cmdlineName] = uint32(pid)
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions common/process/process_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package process
import (
"golang.org/x/sys/windows"
"os"
"slices"
"unsafe"
)

Expand All @@ -11,12 +12,7 @@ func ProcessesPID(names []string) map[string]uint32 {
return windows.UTF16ToString(entry.ExeFile[:])
}
entries := processesEntry(func(entry *windows.ProcessEntry32) bool {
for _, n := range names {
if name(entry) == n {
return true
}
}
return false
return slices.Contains(names, name(entry))
}, false)
processes := make(map[string]uint32)
for _, entry := range entries {
Expand Down
2 changes: 1 addition & 1 deletion go.work.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
go 1.22.0
go 1.23.0

use (
battle-server-broadcast
Expand Down
2 changes: 1 addition & 1 deletion launcher-agent/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/luskaner/ageLANServer/launcher-agent

go 1.22.0
go 1.23.0

require (
github.com/luskaner/ageLANServer/battle-server-broadcast v1.3.0
Expand Down
2 changes: 1 addition & 1 deletion launcher-common/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/luskaner/ageLANServer/launcher-common

go 1.22.0
go 1.23.0

require (
github.com/andygrunwald/vdf v1.1.0
Expand Down
7 changes: 1 addition & 6 deletions launcher-common/ipc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package launcher_common
import (
"github.com/luskaner/ageLANServer/common"
"net"
"os"
"path"
)

const ConfigAdminIpcRevert byte = 0
const ConfigAdminIpcSetup byte = 1
const ConfigAdminIpcExit byte = 2
const configAdminIpcName = common.Name + `-launcher-config-admin-agent`

type (
ConfigAdminIpcSetupCommand struct {
Expand All @@ -23,7 +22,3 @@ type (
Certificate bool
}
)

func ConfigAdminIpcName() string {
return path.Join(os.TempDir(), common.Name+`-launcher-config-admin-agent`)
}
12 changes: 12 additions & 0 deletions launcher-common/ipc_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build !windows

package launcher_common

import (
"os"
"path"
)

func ConfigAdminIpcPath() string {
return path.Join(os.TempDir(), configAdminIpcName)
}
5 changes: 5 additions & 0 deletions launcher-common/ipc_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package launcher_common

func ConfigAdminIpcPath() string {
return `\\.\pipe\` + configAdminIpcName
}
10 changes: 5 additions & 5 deletions launcher-common/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func cachedIpToHosts(ip string) (bool, mapset.Set[string]) {
func cacheMapping(host string, ip string) {
hostToLower := strings.ToLower(host)
if _, exists := hostToIps[hostToLower]; !exists {
hostToIps[hostToLower] = mapset.NewSet[string]()
hostToIps[hostToLower] = mapset.NewThreadUnsafeSet[string]()
}
hostToIps[hostToLower].Add(ip)
if _, exists := ipToHosts[ip]; !exists {
ipToHosts[ip] = mapset.NewSet[string]()
ipToHosts[ip] = mapset.NewThreadUnsafeSet[string]()
}
ipToHosts[ip].Add(host)
if _, exists := failedIpToHosts[ip]; exists {
Expand All @@ -67,7 +67,7 @@ func cacheMapping(host string, ip string) {

func HostOrIpToIps(host string) mapset.Set[string] {
if ip := net.ParseIP(host); ip != nil {
var ips = mapset.NewSet[string]()
var ips = mapset.NewThreadUnsafeSet[string]()
if ip.To4() != nil {
if ip.IsUnspecified() {
ips.Append(ResolveUnspecifiedIps()...)
Expand All @@ -81,7 +81,7 @@ func HostOrIpToIps(host string) mapset.Set[string] {
if cached {
return cachedIps
}
ips := mapset.NewSet[string]()
ips := mapset.NewThreadUnsafeSet[string]()
ipsFromDns := common.HostToIps(host)
if ipsFromDns != nil {
for _, ipRaw := range ipsFromDns {
Expand Down Expand Up @@ -144,7 +144,7 @@ func IpToHosts(ip string) mapset.Set[string] {
if cached {
return cachedHosts
}
hosts := mapset.NewSet[string]()
hosts := mapset.NewThreadUnsafeSet[string]()
hostsFromDns := ipToDnsName(ip)
if hostsFromDns != nil {
for _, hostStr := range hostsFromDns {
Expand Down
2 changes: 1 addition & 1 deletion launcher-config-admin-agent/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/luskaner/ageLANServer/launcher-config-admin-agent

go 1.22.0
go 1.23.0

require (
github.com/luskaner/ageLANServer/common v0.0.0-20241204232812-4e96c2e19aea
Expand Down
19 changes: 2 additions & 17 deletions launcher-config-admin-agent/internal/ipc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
launcherCommon "github.com/luskaner/ageLANServer/launcher-common"
"github.com/luskaner/ageLANServer/launcher-common/executor"
"net"
"os"
)

var mappedCdn = false
Expand Down Expand Up @@ -121,30 +120,16 @@ func handleRevert(decoder *gob.Decoder) int {
}

func RunIpcServer() (errorCode int) {
ipcPath := launcherCommon.ConfigAdminIpcName()

if err := os.Remove(ipcPath); err != nil && !os.IsNotExist(err) {
errorCode = ErrListen
return
}

defer func() {
_ = os.Remove(ipcPath)
}()

l, err := net.Listen("unix", ipcPath)
l, err := SetupIpcServer()
if err != nil {
errorCode = ErrListen
return
}
defer func(l net.Listener) {
_ = l.Close()
RevertIpcServer()
}(l)

if err = os.Chmod(ipcPath, 0666); err != nil {
return
}

var conn net.Conn
for {
conn, err = l.Accept()
Expand Down
30 changes: 30 additions & 0 deletions launcher-config-admin-agent/internal/ipc_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//go:build !windows

package internal

import (
launcherCommon "github.com/luskaner/ageLANServer/launcher-common"
"net"
"os"
)

func SetupIpcServer() (listener net.Listener, err error) {
ipcPath := launcherCommon.ConfigAdminIpcPath()

if err = os.Remove(ipcPath); err != nil && !os.IsNotExist(err) {
return
}

listener, err = net.Listen("unix", ipcPath)

if err != nil {
return
}

err = os.Chmod(ipcPath, 0666)
return
}

func RevertIpcServer() {
_ = os.Remove(launcherCommon.ConfigAdminIpcPath())
}
Loading