diff --git a/instance/client.go b/instance/client.go index 70c8cbd..18ad86e 100644 --- a/instance/client.go +++ b/instance/client.go @@ -16,8 +16,21 @@ import ( func InitClient(proxy string, cfg Config) (*http.Client, error) { // If proxy is empty, return a default client (if proxy from file is false) + unproxiedClient := &http.Client{ + Timeout: time.Second * time.Duration(cfg.ProxySettings.Timeout), + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS13, + CipherSuites: []uint16{0x1301, 0x1302, 0x1303, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035}, + InsecureSkipVerify: true, + CurvePreferences: []tls.CurveID{0x001d, 0x0017, 0x0018}, + }, + DisableKeepAlives: cfg.OtherSettings.DisableKL, + ForceAttemptHTTP2: true, + }, + } if proxy == "" { - return http.DefaultClient, nil + return unproxiedClient, nil } switch cfg.ProxySettings.ProxyProtocol { case "http": @@ -36,7 +49,7 @@ func InitClient(proxy string, cfg Config) (*http.Client, error) { // Error while converting proxy string to url.url would result in default client being returned proxyURL, err := url.Parse(proxy) if err != nil { - return http.DefaultClient, err + return unproxiedClient, err } // Creating a client and modifying the transport. @@ -44,10 +57,10 @@ func InitClient(proxy string, cfg Config) (*http.Client, error) { Timeout: time.Second * time.Duration(cfg.ProxySettings.Timeout), Transport: &http.Transport{ TLSClientConfig: &tls.Config{ - MinVersion: tls.VersionTLS12, - CipherSuites: []uint16{0x1301, 0x1303, 0x1302, 0xc02b, 0xc02f, 0xcca9, 0xcca8, 0xc02c, 0xc030, 0xc00a, 0xc009, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035}, + MinVersion: tls.VersionTLS13, + CipherSuites: []uint16{0x1301, 0x1302, 0x1303, 0xc02b, 0xc02f, 0xc02c, 0xc030, 0xcca9, 0xcca8, 0xc013, 0xc014, 0x009c, 0x009d, 0x002f, 0x0035}, InsecureSkipVerify: true, - CurvePreferences: []tls.CurveID{tls.CurveID(0x001d), tls.CurveID(0x0017), tls.CurveID(0x0018), tls.CurveID(0x0019), tls.CurveID(0x0100), tls.CurveID(0x0101)}, + CurvePreferences: []tls.CurveID{0x001d, 0x0017, 0x0018}, }, DisableKeepAlives: cfg.OtherSettings.DisableKL, ForceAttemptHTTP2: true, diff --git a/instance/direct_messages.go b/instance/direct_messages.go index 4f0c5a6..4bd1e5b 100644 --- a/instance/direct_messages.go +++ b/instance/direct_messages.go @@ -112,94 +112,6 @@ func (in *Instance) GetCookieString() (string, error) { } -// func (in *Instance) GetCookieString() (string, error) { -// if in.Config.OtherSettings.ConstantCookies && in.Cookie != "" { -// return in.Cookie, nil -// } -// if in.Config.OtherSettings.Mode != 2 { -// url := "https://discord.com" - -// req, err := http.NewRequest("GET", url, nil) - -// if err != nil { -// utilities.LogErr("[%v] Error while making request to get cookies %v", time.Now().Format("15:04:05"), err) -// return "", fmt.Errorf("error while making request to get cookie %v", err) -// } -// req = in.cookieHeaders(req) -// resp, err := in.Client.Do(req) -// if err != nil { -// utilities.LogErr("[%v] Error while getting response from cookies request %v", time.Now().Format("15:04:05"), err) -// return "", fmt.Errorf("error while getting response from cookie request %v", err) -// } -// defer resp.Body.Close() - -// if resp.Cookies() == nil { -// utilities.LogErr("[%v] Error while getting cookies from response %v", time.Now().Format("15:04:05"), err) -// return "", fmt.Errorf("there are no cookies in response") -// } -// cookies := "" -// for _, cookie := range resp.Cookies() { -// cookies += fmt.Sprintf(`%s=%s; `, cookie.Name, cookie.Value) -// } -// // CfRay := resp.Header.Get("cf-ray") -// // if strings.Contains(CfRay, "-BOM") { -// // CfRay = strings.ReplaceAll(CfRay, "-BOM", "") -// // } - -// // if CfRay != "" { -// // body, err := ioutil.ReadAll(resp.Body) -// // if err != nil { -// // utilities.LogErr("[%v] Error while reading response body %v", time.Now().Format("15:04:05"), err) -// // return cookies + "locale:en-US", nil -// // } -// // m := regexp.MustCompile(`m:'(.+)'`) -// // match := m.FindStringSubmatch(string(body)) -// // if match == nil { -// // return cookies + "locale:en-US", nil -// // } -// // finalCookies, err := in.GetCfBm(match[1], CfRay, cookies) -// // if err != nil { -// // return cookies + "locale:en-US", nil -// // } -// // finalCookies += "; locale:en-US" -// // return finalCookies, nil -// // } -// cookies += fmt.Sprintf("locale:%s", "en-US") -// if in.Config.OtherSettings.ConstantCookies { -// in.Cookie = cookies -// } -// return cookies, nil -// } else { -// site := "https://discord.com/ios/125.0/manifest.json" -// req, err := http.NewRequest("GET", site, nil) -// if err != nil { -// return "", fmt.Errorf("error while making request to get cookie %v", err) -// } -// req = in.cookieHeaders(req) -// resp, err := in.Client.Do(req) -// if err != nil { -// return "", fmt.Errorf("error while getting response from cookie request %v", err) -// } -// defer resp.Body.Close() -// if resp.Cookies() == nil { -// return "", fmt.Errorf("there are no cookies in response") -// } -// cookies := "" -// for i, cookie := range resp.Cookies() { -// if i != len(resp.Cookies())-1 { -// cookies += fmt.Sprintf(`%s=%s; `, cookie.Name, cookie.Value) -// } else { -// cookies += fmt.Sprintf(`%s=%s`, cookie.Name, cookie.Value) -// } -// } -// if in.Config.OtherSettings.ConstantCookies { -// in.Cookie = cookies -// } -// return cookies, nil -// } - -// } - func (in *Instance) GetCfBm(m, r, cookies string) (string, error) { site := fmt.Sprintf(`https://discord.com/cdn-cgi/bm/cv/result?req_id=%s`, r) payload := fmt.Sprintf( diff --git a/main.go b/main.go index 35579d8..e3675d1 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,7 @@ import ( ) func main() { - version := "1.10.14" + version := "1.10.15" rand.Seed(time.Now().UTC().UnixNano()) color.Blue.Printf(logo + " v" + version + "\n") color.Green.Printf("Made by https://github.com/V4NSH4J\nStar repository on github for updates!\n")