-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
45 lines (38 loc) · 1003 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
35
36
37
38
39
40
41
42
43
44
45
/*
This tool sends an empty UDP packet to a given port and waits for emblems on
another specified port in response. Whenever it receives a set of tokens, it
verifies them.
*/
package main
import (
"flag"
"log"
"github.com/adem-wg/adem-proto/pkg/args"
"github.com/adem-wg/adem-proto/pkg/io"
"github.com/adem-wg/adem-proto/pkg/tokens"
"github.com/adem-wg/adem-proto/pkg/vfy"
)
func init() {
args.AddProbeArgs()
args.AddCTArgs()
args.AddVerificationArgs()
}
func main() {
flag.Parse()
if err := args.FetchKnownLogs(); err != nil {
log.Fatalf("could not fetch known logs: %s", err)
}
trustedKeys, err := tokens.SetKIDs(args.LoadTrustedKeys(), args.LoadTrustedKeysAlg())
if err != nil {
log.Fatalf("could not set trusted keys KIDs: %s", err)
}
results := make(chan io.TokenSet)
go io.UDPProbe(args.ProbePort, args.LoadProbeAddr(), args.ProbeTimeout, results)
for set := range results {
if set == nil {
break
} else {
vfy.VerifyTokens(set, trustedKeys).Print()
}
}
}