-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
52 lines (44 loc) · 960 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
46
47
48
49
50
51
52
package main
// Temporary file
import (
"golang.org/x/net/context"
"github.com/bearded-web/bearded/pkg/script"
"github.com/davecgh/go-spew/spew"
"github.com/bearded-web/bearded/pkg/transport/mango"
"github.com/bearded-web/wappalyzer-script/wappalyzer"
)
func run(addr string) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
transp, err := mango.NewServer(addr)
if err != nil {
panic(err)
}
client, err := script.NewRemoteClient(transp)
if err != nil {
panic(err)
}
go func() {
err := transp.Serve(ctx, client)
if err != nil {
panic(err)
}
}()
println("wait for connection")
client.WaitForConnection(ctx)
println("request config")
conf, err := client.GetConfig(ctx)
if err != nil {
panic(err)
}
app := wappalyzer.New()
println("handle with conf", spew.Sdump(conf))
err = app.Handle(ctx, client, conf)
if err != nil {
panic(err)
}
}
func main() {
run("tcp://:9238")
// run(":9238")
}