forked from NEU-SNS/ReverseTraceroutePublicOld
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
57 lines (53 loc) · 1.21 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Package main is a dummy for testing
package main
import (
"flag"
"fmt"
"io"
"time"
"golang.org/x/net/context"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"github.com/VolSec/ReverseTraceroutePublic/controller/client"
"github.com/VolSec/ReverseTraceroutePublic/datamodel"
)
func main() {
flag.Parse()
vpcreds, err := credentials.NewClientTLSFromFile("/home/rhansen2/sslkey/root.crt", "controller.revtr.ccs.neu.edu")
connvp := fmt.Sprintf("%s:%d", "walter.ccs.neu.edu", 4382)
c3, err := grpc.Dial(connvp, grpc.WithTransportCredentials(vpcreds))
if err != nil {
panic(err)
}
defer c3.Close()
cc := client.New(context.Background(), c3)
pm := datamodel.PingMeasurement{
Src: 2915894044,
Dst: 1023933481,
SAddr: "61.7.252.28",
Spoof: true,
RR: true,
CheckCache: true,
CheckDb: true,
Count: "1",
}
ctx, cancel := context.WithTimeout(context.Background(), time.Second*30)
defer cancel()
c, err := cc.Ping(ctx, &datamodel.PingArg{
Pings: []*datamodel.PingMeasurement{&pm},
})
if err != nil {
panic(err)
}
c.CloseSend()
for {
p, err := c.Recv()
if err == io.EOF {
break
}
if err != nil {
panic(err)
}
fmt.Println(p)
}
}