• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gameap / gameap / 19787975243

29 Nov 2025 06:56PM UTC coverage: 72.247% (-0.02%) from 72.262%
19787975243

push

github

et-nik
update and fix rcon

14 of 17 new or added lines in 5 files covered. (82.35%)

11 existing lines in 1 file now uncovered.

25158 of 34822 relevant lines covered (72.25%)

378.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

38.89
/internal/api/servers/rcon/base/hardcode.go
1
package base
2

3
import (
4
        "strings"
5

6
        "github.com/gameap/gameap/internal/domain"
7
        "github.com/gameap/gameap/pkg/quercon/rcon"
8
        "github.com/pkg/errors"
9
)
10

11
var mapProtocolByGameCode = map[string]rcon.Protocol{
12
        "bms":       rcon.ProtocolSource,  // Black Mesa: Source
13
        "cs":        rcon.ProtocolGoldSrc, // Counter-Strike 1.6
14
        "cs2":       rcon.ProtocolSource,  // Counter-Strike 2
15
        "csgo":      rcon.ProtocolSource,  // Counter-Strike: Global Offensive
16
        "cssource":  rcon.ProtocolSource,  // Counter-Strike: Source
17
        "cssv34":    rcon.ProtocolSource,  // Counter-Strike: Source v34
18
        "cstrike":   rcon.ProtocolGoldSrc, // Counter-Strike 1.6
19
        "czero":     rcon.ProtocolSource,  // Counter-Strike: Condition Zero
20
        "dmc":       rcon.ProtocolSource,  // Deathmatch Classic
21
        "dod":       rcon.ProtocolGoldSrc, // Day of Defeat
22
        "dods":      rcon.ProtocolSource,  // Day of Defeat: Source
23
        "garrysmod": rcon.ProtocolSource,  // Garry's Mod
24
        "gearbox":   rcon.ProtocolGoldSrc, // Half-Life: Opposing Force
25
        "hl":        rcon.ProtocolGoldSrc, // Half-Life
26
        "hl2mp":     rcon.ProtocolSource,  // Half-Life 2: Deathmatch
27
        "l4d":       rcon.ProtocolSource,  // Left 4 Dead
28
        "l4d2":      rcon.ProtocolSource,  // Left 4 Dead 2
29
        "minecraft": rcon.ProtocolSource,  // Minecraft
30
        "op4":       rcon.ProtocolGoldSrc, // Half-Life: Opposing Force
31
        "ricochet":  rcon.ProtocolGoldSrc, // Ricochet
32
        "svencoop":  rcon.ProtocolGoldSrc, // Sven Co-op
33
        "tf2":       rcon.ProtocolSource,  // Team Fortress 2
34
        "tfc":       rcon.ProtocolGoldSrc, // Team Fortress Classic
35
        "valve":     rcon.ProtocolGoldSrc, // Half-Life
36
}
37

38
var mapProtocolByEngine = map[string]rcon.Protocol{
39
        "goldsource": rcon.ProtocolGoldSrc,
40
        "goldsrc":    rcon.ProtocolGoldSrc,
41
        "source":     rcon.ProtocolSource,
42
        "minecraft":  rcon.ProtocolSource,
43
}
44

UNCOV
45
func DetermineProtocol(game domain.Game) (rcon.Protocol, error) {
×
UNCOV
46
        protocol, err := DetermineProtocolByEngine(game.Engine)
×
UNCOV
47
        if err == nil {
×
UNCOV
48
                return protocol, nil
×
UNCOV
49
        }
×
50

UNCOV
51
        return DetermineProtocolByGameCode(game.Code)
×
52
}
53

54
func DetermineProtocolByEngine(engine string) (rcon.Protocol, error) {
4✔
55
        engine = strings.ToLower(engine)
4✔
56

4✔
57
        if protocol, ok := mapProtocolByEngine[engine]; ok {
6✔
58
                return protocol, nil
2✔
59
        }
2✔
60

61
        return "", errors.Errorf("unable to determine RCON protocol for engine: %s", engine)
2✔
62
}
63

UNCOV
64
func DetermineProtocolByGameCode(gameCode string) (rcon.Protocol, error) {
×
UNCOV
65
        if protocol, ok := mapProtocolByGameCode[gameCode]; ok {
×
UNCOV
66
                return protocol, nil
×
UNCOV
67
        }
×
68

UNCOV
69
        return "", errors.Errorf("unable to determine RCON protocol for game code: %s", gameCode)
×
70
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc