mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 03:27:39 +08:00
feat: buildin tmdb dns
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package tmdb
|
package tmdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"polaris/log"
|
"polaris/log"
|
||||||
@@ -40,6 +42,21 @@ func NewClient(apiKey, proxyUrl string, enableAdultContent bool) (*Client, error
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tmdbClient.SetClientConfig(http.Client{
|
||||||
|
Timeout: time.Second * 10,
|
||||||
|
Transport: &http.Transport{
|
||||||
|
MaxIdleConns: 10,
|
||||||
|
IdleConnTimeout: 15 * time.Second,
|
||||||
|
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
|
if addr == "api.themoviedb.org:443" {
|
||||||
|
addr = "18.161.6.19:443"
|
||||||
|
}
|
||||||
|
return net.DialTimeout(network, addr, 10*time.Second)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Client{
|
return &Client{
|
||||||
|
|||||||
Reference in New Issue
Block a user