xxf098/LiteSpeedTest

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

Opened this issue · 0 comments

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" (telmo.trooper@gmail.com)

#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