forked from tonkeeper/tongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
34 lines (32 loc) · 802 Bytes
/
main.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
package main
import (
"context"
"encoding/base64"
"encoding/hex"
"fmt"
"github.com/tonkeeper/tongo/liteclient"
)
func main() {
myPayload, _ := hex.DecodeString("7af98bb435263e6c95d6fecb497dfd0aa5f031e7d412986b5ce720496db512052e8f2d100cdf068c7904345aad16000000000000")
serverPubkey, err := base64.StdEncoding.DecodeString("wQE0MVhXNWUXpWiW5Bk8cAirIh5NNG3cZM1/fSVKIts=")
if err != nil {
panic(err)
}
c, err := liteclient.NewConnection(context.Background(), serverPubkey, "135.181.140.221:46995")
if err != nil {
panic(err)
}
packet, err := liteclient.NewPacket(myPayload)
if err != nil {
panic(err)
}
fmt.Printf("Send: %x\n", myPayload)
err = c.Send(packet)
if err != nil {
panic(err)
}
for p := range c.Responses() {
fmt.Printf("Received: %x\n", p.Payload)
return
}
}