try https proxy

This commit is contained in:
Philip Hamer 2021-11-16 23:26:29 -05:00
parent e8629af678
commit d229c9f93d
No known key found for this signature in database
GPG Key ID: 1977721B2884BED3
1 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,7 @@ package websocket
import (
"bufio"
"crypto/tls"
"encoding/base64"
"errors"
"net"
@ -20,10 +21,21 @@ func (fn netDialerFunc) Dial(network, addr string) (net.Conn, error) {
return fn(network, addr)
}
type tlsDialer struct {
}
func (t *tlsDialer) Dial(network, addr string) (c net.Conn, err error) {
return tls.DialWithDialer(&net.Dialer{}, network, addr, &tls.Config{})
}
func init() {
proxy_RegisterDialerType("http", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
return &httpProxyDialer{proxyURL: proxyURL, forwardDial: forwardDialer.Dial}, nil
})
proxy_RegisterDialerType("https", func(proxyURL *url.URL, forwardDialer proxy_Dialer) (proxy_Dialer, error) {
dialer := &tlsDialer{}
return &httpProxyDialer{proxyURL: proxyURL, forwardDial: dialer.Dial}, nil
})
}
type httpProxyDialer struct {