This commit is contained in:
shoopea 2020-06-21 16:31:09 +02:00
parent c303368519
commit 9e060d5a64

View File

@ -5,6 +5,7 @@ import (
"encoding/binary" "encoding/binary"
"net" "net"
"regexp" "regexp"
"strconv"
) )
type Client struct { type Client struct {
@ -193,10 +194,10 @@ func main() {
if ok { if ok {
clt := Client{} clt := Client{}
r, _ := regexp.Compile("Client #(?P<ClientID>[0-9]+) name: '(?P<Name>.*)' company: (?P<CompanyID>[0-9]+) IP: (?P<Address>.*)") r, _ := regexp.Compile("Client #(?P<ClientID>[0-9]+) name: '(?P<Name>.*)' company: (?P<CompanyID>[0-9]+) IP: (?P<Address>.*)")
clt.ClientID, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${ClientID}"), 10, 32) clt.ClientID, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${ClientID}"), 10, 32)
clt.Name = r.ReplaceAllString(m.Text, "${ClientID}") clt.Name = r.ReplaceAllString(sp.Output, "${ClientID}")
clt.CompanyID, _ = strconv.ParseInt(r.ReplaceAllString(m.Text, "${CompanyID}"), 10, 8) clt.CompanyID, _ = strconv.ParseInt(r.ReplaceAllString(sp.Output, "${CompanyID}"), 10, 8)
clt.Address = r.ReplaceAllString(m.Text, "${Address}") clt.Address = r.ReplaceAllString(sp.Output, "${Address}")
clients[clt.ClientID] = clt clients[clt.ClientID] = clt
} }
case AdminPacketServerRConEnd: case AdminPacketServerRConEnd: