-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain.go
55 lines (43 loc) · 1.12 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
package main
import (
"context"
"fmt"
"github.com/StinkyPeach/bridge/adapter/outbound"
"github.com/StinkyPeach/bridge/log"
"time"
)
func main() {
log.Info("this is ssr test")
//ssrNode := make(map[string]interface{})
//ssrNode["name"] = "test"
//ssrNode["type"] = "ssr"
//ssrNode["server"] = "127.0.0.1"
//ssrNode["port"] = 8388
//ssrNode["password"] = "password"
//ssrNode["cipher"] = "rc4-md5"
//ssrNode["obfs"] = "http_post"
//ssrNode["obfs-param"] = ""
//ssrNode["protocol"] = "origin"
//ssrNode["protocol-param"] = ""
//ssrNode["udp"] = true
//
//p, err := outbound.ParseProxy(ssrNode)
socks5Node := make(map[string]interface{})
socks5Node["name"] = "test"
socks5Node["type"] = "socks5"
socks5Node["server"] = "127.0.0.1"
socks5Node["port"] = 7890
socks5Node["udp"] = false
socks5Node["skip-cert-verify"] = true
p, err := outbound.ParseProxy(socks5Node)
if err != nil {
fmt.Println(err)
}
ur := "https://www.google.com"
ctx, _ := context.WithTimeout(context.Background(), time.Second*10)
latency, err := p.URLTest(ctx, ur)
if err != nil {
panic(err)
}
log.Info("latency: %d ms", latency)
}