summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsjlleo <[email protected]>2021-10-08 07:28:22 +0800
committerGitHub <[email protected]>2021-10-08 07:28:22 +0800
commit17882bf66808e8961d14e6709d2d81ec3e880338 (patch)
tree4bb991f8a17719f22bc727d89226f36ecced2995
parentfebf26187f23bd7f98f8bd6f13fa79461fdc9b91 (diff)
parentf220261d98af524dc0f603db3bc9483a2a0d5e55 (diff)
Merge pull request #14 from caobug/main
Specify network address to use
-rw-r--r--nf.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/nf.go b/nf.go
index 5eeb11f..027fab1 100644
--- a/nf.go
+++ b/nf.go
@@ -2,6 +2,7 @@ package main
import (
"crypto/tls"
+ "flag"
"fmt"
"net"
"net/http"
@@ -10,12 +11,12 @@ import (
"strconv"
"strings"
"time"
- "flag"
)
const Netflix = "https://www.netflix.com/title/"
var method = flag.String("method","","模式选择(full/lite)")
var custom = flag.String("custom","","自定义测试NF影片ID\n绝命毒师的ID是70143836")
+var address = flag.String("address", "", "本机公网IP")
func RequestIP(requrl string, ip string) string {
if ip == "" {
@@ -35,6 +36,11 @@ func RequestIP(requrl string, ip string) string {
TLSClientConfig: &tls.Config{ServerName: host},
// goodryb pull
Proxy: http.ProxyFromEnvironment,
+ DialContext: (&net.Dialer{
+ LocalAddr: &net.TCPAddr{
+ IP: net.ParseIP(*address),
+ },
+ }).DialContext,
},
CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse },
Timeout: 5 * time.Second,