add map as tag
This commit is contained in:
10
main.go
10
main.go
@@ -26,7 +26,6 @@ type TF2Server string
|
||||
|
||||
var (
|
||||
server = flag.String("server", "", "comma seperated list of addresses to query")
|
||||
oldIDs = flag.Bool("oldids", false, "use old gamedig IDs")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -49,10 +48,10 @@ func main() {
|
||||
|
||||
enc.StartLine("tf2server")
|
||||
enc.AddTag("address", string(ip))
|
||||
enc.AddTag("map", tStat.Map)
|
||||
enc.AddTag("name", tStat.Name)
|
||||
enc.AddField("player", lineprotocol.IntValue(int64(tStat.NumPlayers)))
|
||||
enc.AddField("maxplayer", lineprotocol.IntValue(int64(tStat.MaxPlayers)))
|
||||
enc.AddField("map", lineprotocol.MustNewValue(tStat.Map))
|
||||
enc.AddField("ping", lineprotocol.IntValue(int64(tStat.Ping)))
|
||||
enc.EndLine(time.Now())
|
||||
fmt.Print(string(enc.Bytes()))
|
||||
@@ -60,12 +59,7 @@ func main() {
|
||||
}
|
||||
|
||||
func (ip TF2Server) Stats() (*TF2Stat, error) {
|
||||
gameID := "teamfortress2"
|
||||
if *oldIDs {
|
||||
gameID = "tf2"
|
||||
}
|
||||
|
||||
cmd := exec.Command("gamedig", "--type", gameID, string(ip))
|
||||
cmd := exec.Command("gamedig", "--type", "teamfortress2", string(ip))
|
||||
bOut, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Reference in New Issue
Block a user