Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow {InsecureSkipVerify: true} for http.Client.get(subscription_link) #42

Open
ggzzzzzzz opened this issue Jun 23, 2023 · 0 comments
Open

Comments

@ggzzzzzzz
Copy link

ggzzzzzzz commented Jun 23, 2023

vi web/profile.go
#######################
package web

import (
"net/http"
"crypto/tls"
#######################

// support proxy
// concurrency setting
// as subscription server
// profiles filter
// clash to vmess local subscription
func getSubscriptionLinks(link string) ([]string, error) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
c := http.Client{
Timeout: 20 * time.Second,
Transport: tr,
}
resp, err := c.Get(link)
###########################

Sometimes I will use python3 http.server to start https server to serve subscription link, {InsecureSkipVerify: true} is convenient for such a scenario.

#!/usr/bin/env python3
#by Honghe
#Ported to Python 3 by Telmo "Trooper" ([email protected])

#Original code from:
#http://www.piware.de/2011/01/creating-an-https-server-in-python/
#https://gist.github.com/dergachev/7028596

#To generate a certificate use:
#openssl req -newkey rsa:4096 -nodes -keyout key.pem -x509 -days 365 -out cert.pem

from http.server import HTTPServer, SimpleHTTPRequestHandler
import ssl

port = 4443
httpd = HTTPServer(('127.0.0.1', port), SimpleHTTPRequestHandler)
httpd.socket = ssl.wrap_socket(httpd.socket, keyfile='key.pem', certfile="cert.pem", server_side=True)

print("Server running on https://127.0.0.1:" + str(port))

httpd.serve_forever()

##################################
Above solution tested, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant