Skip to content

Commit

Permalink
0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason5Lee committed May 5, 2021
1 parent b4cc800 commit d4c4bef
Show file tree
Hide file tree
Showing 7 changed files with 1,007 additions and 187 deletions.
75 changes: 11 additions & 64 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "h2sr"
version = "0.1.1"
version = "0.2.0"
authors = ["jasondhli <jasondhli@tencent.com>"]
edition = "2018"
license = " Apache-2.0"
Expand All @@ -16,11 +16,12 @@ tokio = { version = "1.4", features = ["full"] }
http = "0.2"
tokio-socks = "0.5"
anyhow = "1.0"
clap = "2.33"
directories = "3.0"
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
iprange = "0.6"
ipnet = "2.3"
ansi_term = "0.12"
fdlimit = "0.2"
protobuf = "2.23"
once_cell = "1.7"
46 changes: 27 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,42 @@ You can download the prebuilt binaries for macOS, Linux and Windows in [github r

## Usage

```
h2sr 0.1.1
Http-to-socks5 proxy router
USAGE:
h2sr [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
Put the configuration file at `$HOME/.h2sr/config.toml` .

OPTIONS:
-c, --config <PATH> The config file path, if it isn't present, the program will find ".h2sr.toml" in the user
directory
```
Optionally put the [`geoip.dat`](https://github.com/v2fly/geoip/releases) file at `$HOME/.h2sr/geoip.dat` .

## Config file format

```toml
listen = "127.0.0.1:8080" # Address the http proxy listen to.
socks5addr = "127.0.0.1:1086" # Address of the socks5 proxy.
proxy = [
"the.domain.suffix.you.want.to.be.proxied.com",
"3.3.3.3/24" # CIDR ipv4 range
proxydomains = [
"the.domain.suffix.you.want.to.connect.through.proxy.com",
]
proxyips = [
"3.3.3.3/24", # CIDR ipv4 range
"geo:us", # IP location, requires `geoip.dat`.
]
block = [

# Only one of proxydomains and directdomains can be set.
directdomains = [
"the.domain.suffix.you.want.to.connect.directly.com",
]
# Only one of proxyips and directips can be set.
directips = [
"3.3.3.3/24", # CIDR ipv4 range
"geo:private", # IP location, requires `geoip.dat`.
]
blockdomains = [
"the.domain.suffix.you.want.to.be.blocked.com",
"3.4.3.3/24" # CIDR ip range
]
blockips = [
"3.4.3.3/24", # CIDR ip range
]

```

## Update in 0.2.0

- More flexible rule.
- geoip.dat supports.
23 changes: 23 additions & 0 deletions src/ipgeo.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
syntax = "proto3";

package me.jason5lee.h2sr;


message GeoIPList {
repeated GeoIP entry = 1;
}

message GeoIP {
string country_code = 1;
repeated CIDR cidr = 2;
bool reverse_match = 3;
}

message CIDR {
// IP address, should be either 4 or 16 bytes.
bytes ip = 1;

// Number of leading ones in the network mask.
uint32 prefix = 2;
}

Loading

0 comments on commit d4c4bef

Please sign in to comment.