Skip to content

Commit 223e42a

Browse files
committed
opt first fetch speed
1 parent f63627a commit 223e42a

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

client.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ func (cli *client) Post(url, contentType string, body io.Reader) (resp *http.Res
5555
//return cli.client.Post(url, contentType, body)
5656
}
5757

58+
func (cli *client) Dummy_Get(url string) (resp *http.Response, err error) {
59+
return cli.client.Get(url)
60+
}
61+
5862
func (cli *client) Do(req *http.Request) (resp *http.Response, err error) {
5963
if req == nil {
6064
log.Printf("POST Request == nil")
@@ -135,6 +139,9 @@ func (cli *client) init_client() {
135139
cli.client = &http.Client{
136140
Transport: cli.tr,
137141
}
142+
//for cache tcp & dns(not must)
143+
res, _ := cli.Dummy_Get(cli.cfg.Fetchserver)
144+
res.Body.Close()
138145
}
139146

140147
func (cli *client) VerifyConnection(cs tls.ConnectionState) error {

proxy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ func (prx *proxy) init_ca() {
8383
if err != nil {
8484
log.Fatal(err)
8585
}
86+
//prepare gen google cert for cache(not must)
87+
_ = prx.signer.SignHost("www.google.com")
88+
_ = prx.signer.SignHost("www.youtube.com")
89+
_ = prx.signer.SignHost("www.googlevideo.com")
90+
_ = prx.signer.SignHost("www.gstatic.com")
91+
_ = prx.signer.SignHost("www.ggpht.com")
8692
}
8793

8894
func (prx *proxy) init_proxy() {

0 commit comments

Comments
 (0)