Пример #1
0
func torAutoProxy(u *url.URL, d proxy.Dialer) (proxy.Dialer, error) {
	auth := genTorAutoAuth(u)
	addr := genTorAutoAddr(u)
	if addr == "" {
		return nil, ErrTorNotRunning
	}
	return proxy.SOCKS5("tcp", addr, auth, d)
}
Пример #2
0
func socks5UnixProxy(u *url.URL, d proxy.Dialer) (proxy.Dialer, error) {
	var auth *proxy.Auth
	if u.User != nil {
		auth = &proxy.Auth{
			User: u.User.Username(),
		}

		if p, ok := u.User.Password(); ok {
			auth.Password = p
		}
	}

	return proxy.SOCKS5("unix", u.Path, auth, d)
}