Jan
24
1 day ago
Activity icon
fork

developerdong forked shadowsocks/go-shadowsocks2

⚡ Modern Shadowsocks in Go
developerdong Apache License 2.0 Updated
fork time in 1 day ago
Jan
21
4 days ago
started
started time in 4 days ago
Jan
20
5 days ago
Jan
19
6 days ago
Activity icon
issue

Princejona issue comment shadowsocks/go-shadowsocks2

Princejona
Princejona

Feature Request: multiuser support

请问 go-shadowsocks2 支持多用户和多端口模式吗? The go-shadowsocks2 support multi-user and multi port mode? 比如读取这种config.json的配置文件的形式? like useing this config.json conf file? { "port_password": { "9998": "xxxx", "9999": "xxxx" }, "server": "0.0.0.0", "timeout": 300, "method": "aes-256-gcm", "fast_open": true }

Princejona
Princejona

i ask if it now supported multi password?

Jan
18
1 week ago
started
started time in 6 days ago
Activity icon
issue

JimLee1996 issue comment shadowsocks/go-shadowsocks2

JimLee1996
JimLee1996

Support http proxy

I'm currently running the http proxy locally with the following implementation, which takes care of both plain http request and the http CONNECT. I'm wondering whether the http proxy can be supported. If it's okay, I can make a pull request or you can just add the implementation by yourself.

in main.go

flag.StringVar(&flags.HttpProxy, "http-proxy", "", "(client-only) http CONNECT listen address")

if flags.HttpProxy != "" {
	go httpLocal(flags.HttpProxy, addr, ciph.StreamConn)
}

in tcp.go

func httpLocal(addr, server string, shadow func(net.Conn) net.Conn) {
	logf("http proxy %s <-> %s", addr, server)
	tcpLocal(addr, server, shadow, func(c net.Conn) (socks.Addr, error) { return httpproxy.Handshake(c) })
}

httpproxy.go

package httpproxy

import (
	"bufio"
	"bytes"
	"io"
	"net/http"
	"strings"

	"github.com/shadowsocks/go-shadowsocks2/socks"
)

func Handshake(rw io.ReadWriter) (socks.Addr, error) {
	var buf bytes.Buffer
	req, err := http.ReadRequest(bufio.NewReader(io.TeeReader(rw, &buf))) // TeeReader keeps a copy of data read in case it's a plain http req
	if err != nil {
		return nil, err
	}

	/**
	 * for plain http://
	 *
	 * GET /ip HTTP/1.1
	 * Host: httpbin.org
	 * User-Agent: curl/7.79.1
	 * Accept: &#42;/&#42;
	 * Proxy-Connection: Keep-Alive
	 * content-length: 0
	 */
	if req.Method != "CONNECT" {
		target := req.Host
		if !strings.Contains(target, ":") {
			target = target + ":80"
		}
		addr := socks.ParseAddr(target)

		data := buf.Bytes()

		nAddr := len(addr)
		nData := len(data)
		addrWithData := make([]byte, nAddr+nData)
		copy(addrWithData[:nAddr], addr)
		copy(addrWithData[nAddr:], data)

		return addrWithData, nil
	}

	/**
	 * for tcp/ssl/tls, including https://
	 *
	 * CONNECT streamline.t-mobile.com:22 HTTP/1.1
	 * User-Agent: curl/7.79.1
	 */
	rw.Write([]byte("HTTP/1.1 200 Connection Established\r\n" +
		"Proxy-agent: Golang-Proxy\r\n" +
		"\r\n"))
	target := req.RequestURI
	addr := socks.ParseAddr(target)

	return addr, nil
}

Activity icon
issue

BigSully issue comment shadowsocks/go-shadowsocks2

BigSully
BigSully

go-shadowsocks2 with http Request-Line encode on client.

@justlovediaodiao go-shadowsocks2 work fine, but i am looking a way to create a showsocks that can send a HTTP " Request-Line " with " GET " ; there is a ID (maybe it is the user and pass encode ) and then there must be a allowed websites by the firewall or allow domain by the firewall encode ( note: that domain or website it is not the server of the shadowsocks ) . So i think the server should understand those parameter .

Here is a packet data i captured , you can see it with WIRESHARK program on pc https://www.wireshark.org/download.html or online creating a free account on www.cloudshark.org/login Attatch file: quantumnica1.zip

example : GET #2&0=c610d32167c94e46a48d959354202365&1=34c961c67ff3b923603867b1aecd506b&2=0&3=1&4=4&ope=1&cy=Claro-ni&7=dx1iv8o-nX8xY4AUPc9tWA==#1.1

As you can see in this screenshot: Shadowsocks with http request encode

BigSully
BigSully

Here is one implementation of http proxy, compile it yourself if you cannot wait.

Activity icon
issue

BigSully issue comment shadowsocks/go-shadowsocks2

BigSully
BigSully

Feature Request: HTTP proxy

Hi! Please add ability run SOCK and HTTP proxy at the same time.

BigSully
BigSully

You can compile the http proxy support yourself with this implementation.

Activity icon
issue

BigSully issue comment shadowsocks/go-shadowsocks2

BigSully
BigSully

Make only one session between client and server?

Hey.

Let's say I have established a connection between the client and the server and exposing a socks server on the client. Each time that I'll use the SOCKS server, a new connection will be created between the client and the server. This is a problem for me because I want to control the source port that the client uses.

Is there any way to transfer all SOCKS data through one long lasting session?

Thanks

BigSully
BigSully

@Sia200 You can take a look at chisel. Chisel maintains one websocket connection, and create new session(ssh channel) on this exact one existing connection.

Previous