-
Notifications
You must be signed in to change notification settings - Fork 59
/
main.go
93 lines (81 loc) · 2.57 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package main
import "C"
import (
"bytes"
"fmt"
"github.com/qtgolang/SunnyNet/src/http"
_ "github.com/qtgolang/SunnyNet/src/http/pprof"
"github.com/qtgolang/SunnyNet/src/tlsClient/srt"
tlsClient "github.com/qtgolang/SunnyNet/src/tlsClient/tlsClient"
"github.com/qtgolang/SunnyNet/src/tlsClient/tlsClient/profiles"
"io"
"log"
"os"
)
const information = `
------------------------------------------------------
欢迎使用Sunny网络中间件
本项目为开源项目
仅用于技术交流学习和研究的目的
请遵守法律法规,请勿用作任何非法用途
否则造成一切后果自负
若您下载并使用即视为您知晓并同意
------------------------------------------------------
Sunny开源项目网站:https://esunny.vip
Sunny QQ交流群(一群):751406884
Sunny QQ交流群(二群):545120699
Sunny QQ交流群(三群):170902713
QQ频道:https://pd.qq.com/g/SunnyNetV5
------------------------------------------------------
`
func init() {
fmt.Println(information)
go http.ListenAndServe("0.0.0.0:6001", nil)
}
func main() {
Test()
}
func main3() {
defer os.Exit(0)
// Create a SpoofedRoundTripper that implements the http.RoundTripper interface
tr, err := srt.NewSpoofedRoundTripper(
// Reference for more: https://bogdanfinn.gitbook.io/open-source-oasis/tls-client/client-options
tlsClient.WithRandomTLSExtensionOrder(), // needed for Chrome 107+
tlsClient.WithClientProfile(profiles.Chrome_124),
)
if err != nil {
panic(err)
}
client := &http.Client{
Transport: tr,
}
Body := io.NopCloser(bytes.NewBuffer([]byte("")))
defer func() { _ = Body.Close() }()
req, err := http.NewRequest("GET", ("https://tls.browserleaks.com/json"), Body)
if err != nil {
panic(err)
}
req.Header.Set("Host", "www.qq.com")
req.Header.Set("Token", "123456789")
req.Header.Set("aBC", "6666xxxxxx66")
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer func() { _ = res.Body.Close() }()
body, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println("响应状态码", res.StatusCode)
for k, v := range res.Header {
fmt.Println(k, v)
}
fmt.Println(string(body))
}
func main2() {
h1s := &http.Server{
Addr: ":8080",
}
log.Fatal(h1s.ListenAndServeTLS("D:\\Go\\PATH\\pkg\\mod\\github.com\\globalsign\\[email protected]\\harness\\certs\\server.crt", "D:\\Go\\PATH\\pkg\\mod\\github.com\\globalsign\\[email protected]\\harness\\certs\\server.key"))
}