forked from ta3pks/betradarProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
betradar.go
40 lines (36 loc) · 787 Bytes
/
betradar.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import "fmt"
import (
"net"
"encoding/xml"
"./lib"
)
type Ask struct {
XMLName xml.Name `xml:"BookmakerStatus"`
Bookmakerid string `xml:"bookmakerid,attr"`
Type string `xml:"type,attr"`
Timestamp int64 `xml:"timestamp,attr"`
Key string `xml:"key,attr"`
}
func (ask *Ask) Send(sock net.Conn) error {
d, err := xml.Marshal(ask)
if nil != err {
return err
}
d = append(d, '\n')
fmt.Print(string(d))
_, err = sock.Write(d)
return err
}
func AskWithValues(id string, tp string, ts int64, key string) *Ask {
return &Ask{
Bookmakerid: id,
Type: tp,
Timestamp: ts,
Key: key,
}
}
func Login(sock net.Conn) {
AskWithValues(*lib.Id, "login", 0, *lib.Key).Send(sock)
sock.Write([]byte("<StartAuto/>\n"))
}