shadowsocks / shadowsocks/shadowsocks-rust

[Feature Request] One sslocal instance to handle multi-proxies, each of which can use dedicated ssservers

Open
#1,978 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
10.9k
Forks
1.5k
Avg merge
4d 15h
Merged PRs (30d)
5

Description

shadowsocks-rust is so powerful that it’s completely suitable for enterprise use. In fact my company is using it in several scenarios, one of which is to act as proxies of the outgoing SMTP server. For the cost reason, the company does not use a commercial email service but is running its own business email server to handle communications with its suppliers and customers all over the world. As you know, IP addresses from certain regions are usually blocked by some other regions, so I have to set up several ssservers in different regions - USA, Germany, Singapore and locally, and each configuration is like:

{
    "servers": [
        {
            "acl": "/etc/ss/sss.acl",
            "server": "0.0.0.0",
            "server_port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        }
    ]
}

On the email server I set up several sslocal instances as transparent proxies, each of which uses certain ssservers:

// local transparent proxy No.1 - dedicated to North America:
{
    "locals": [
        {
            "local_address": "127.0.0.1",
            "local_port": 8301,
            "protocol": "redir",
            "tcp_redir": "redirect"
        }
    ],

    "servers": [
        {
            "tcp_weight": 1.0,
            "address": "IP_in_USA",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "tcp_weight": 0.8,
            "address": "IP_in_Germany",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        }
    ]
}

// local transparent proxy No.2 - dedicated to Asia Pacific and Africa:
{
    "locals": [
        {
            "local_address": "127.0.0.1",
            "local_port": 8302,
            "protocol": "redir",
            "tcp_redir": "redirect"
        }
    ],

    "servers": [
        {
            "tcp_weight": 1.0,
            "address": "IP_Locally",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "tcp_weight": 0.8,
            "address": "IP_in_Singapore",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        }
    ]
}

// local transparent proxy No.3 - dedicated to Europe:
{
    "locals": [
        {
            "local_address": "127.0.0.1",
            "local_port": 8303,
            "protocol": "redir",
            "tcp_redir": "redirect"
        }
    ],

    "servers": [
        {
            "tcp_weight": 1.0,
            "address": "IP_in_Germany",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "tcp_weight": 0.8,
            "address": "IP_in_Singapore",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        }
    ]
}

As you can see, I have to run individual sslocal instance for different group of ssservers. Now I hope to run only one sslocal instance to handle multi-proxies, each of which has dedicated ssservers. The sole configuration might like:

{
    "locals": [
        {
            "local_address": "127.0.0.1",
            "local_port": 8301,
            "protocol": "redir",
            "tcp_redir": "redirect",
            "remotes":
            {
               "USA":1.0,
               "Germany":0.8
            }
        },
        {
            "local_address": "127.0.0.1",
            "local_port": 8302,
            "protocol": "redir",
            "tcp_redir": "redirect",
            "remotes":
            {
                "Locally":1.0,
                "Singapore":0.8
            }
       },
       {
            "local_address": "127.0.0.1",
            "local_port": 8303,
            "protocol": "redir",
            "tcp_redir": "redirect",
            "remotes":
            {
                "Germany":1.0,
                "Singapore":0.8
            }
      }
    ],

    "servers": [
        {
            "name": "Locally",
            "address": "IP_Locally",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "name": "USA",
            "address": "IP_in_USA",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "name": "Singapore",
            "address": "IP_in_Singapore",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        },
        {
            "name": "Germany",
            "address": "IP_in_Germany",
            "port": 8443,
            "method": "aes-256-gcm",
            "password": "Password@Port:8443"
        }
    ]
}

I believe all enterprise users would appreciate this feature very much.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named in the issue. Start by locating sslocal's configuration and transparent-proxy handling, then determine how multiple locals could select dedicated servers and define tests for the proposed configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.