Commit Graph

113 Commits

Author SHA1 Message Date
yuhan6665 fa5d7a255b
Least load balancer (#2999)
* v5: Health Check & LeastLoad Strategy (rebased from 2c5a71490368500a982018a74a6d519c7e121816)

Some changes will be necessary to integrate it into V2Ray

* Update proto

* parse duration conf with time.Parse()

* moving health ping to observatory as a standalone component

* moving health ping to observatory as a standalone component: auto generated file

* add initialization for health ping

* incorporate changes in router implementation

* support principle target output

* add v4 json support for BurstObservatory & fix balancer reference

* update API command

* remove cancelled API

* return zero length value when observer is not found

* remove duplicated targeted dispatch

* adjust test with updated structure

* bug fix for observer

* fix strategy selector

* fix strategy least load

* Fix ticker usage

ticker.Close does not close ticker.C

* feat: Replace default Health Ping URL to HTTPS (#1991)

* fix selectLeastLoad() returns wrong number of nodes (#2083)

* Test: fix leastload strategy unit test

* fix(router): panic caused by concurrent map read and write (#2678)

* Clean up code

---------

Co-authored-by: Jebbs <qjebbs@gmail.com>
Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
Co-authored-by: 世界 <i@sekai.icu>
Co-authored-by: Bernd Eichelberger <46166740+4-FLOSS-Free-Libre-Open-Source-Software@users.noreply.github.com>
Co-authored-by: 秋のかえで <autmaple@protonmail.com>
Co-authored-by: Rinka <kujourinka@gmail.com>
2024-02-17 22:51:37 -05:00
yuhan6665 d83ccaeea9 Clean up legacy compile directive 2024-02-06 21:17:21 -05:00
nobody d20a835016
Fix concurrent map writes error in ohm.Select(). (#2943)
* Add unit test for ohm.tagsCache.

* Fix concurrent map writes in ohm.Select().

---------

Co-authored-by: nobody <nobody@nowhere.mars>
2024-01-16 10:52:01 -05:00
nobody 7f7f57d3b6
Add tags cache to app.proxyman.ohm.Select() (#2927)
* Add tags cache to ohm.Select().

* Refactor round-robin.

* Fix a bug.

---------

Co-authored-by: nobody <nobody@nowhere.mars>
2024-01-12 10:36:48 -05:00
Hossin Asaadi 81f9f567ff
sort Outbound selector output (#2914)
* clean code

* sort oubound selector output

* clean up

* fix duplicate outbound
2024-01-10 11:26:27 -05:00
hossinasaadi 9a2ab9b6a3 fix roundRobin 2024-01-07 14:27:37 -05:00
dop-bot 60f7a03e1b
fix(dns): avoid early return when dns query refused (#2878)
* avoid early return when dns query refused

* address reviews
2024-01-01 23:03:36 -05:00
Hossin Asaadi 01c14a5994
add Round-Robin Strategy to balancer (#2844)
* add Round-Robin Strategy

* clean up
2023-12-24 15:29:10 -05:00
yuhan6665 d60281d0a5 Add DestIpAddress() in Dialer interface
Android client prepares an IP before proxy connection is established. It is useful when connecting to wireguard (or quic) outbound with domain address. E.g. engage.cloudflareclient.com:2408
2023-12-18 18:36:56 -05:00
yuhan6665 d9fd3f8eb1
Freedom xdomain strategy (#2719)
* 统一 `domainStrategy` 行为.

* aliases NG.

* 化简.

* 调整.

* Let it crash.

* Update proto

---------

Co-authored-by: rui0572 <125641819+rui0572@users.noreply.github.com>
2023-11-12 16:27:39 -05:00
cty123 4f6042c69f feat(dns): Support DNS queryStrategy config per NameServer. 2023-09-22 10:34:36 -04:00
yuhan6665 efd32b0fb2 Enable splice for freedom outbound (downlink only)
- Add outbound name
- Add outbound conn in ctx
- Refactor splice: it can be turn on from all inbounds and outbounds
- Refactor splice: Add splice copy to vless inbound
- Fix http error test
- Add freedom splice toggle via env var
- Populate outbound obj in context
- Use CanSpliceCopy to mark a connection
- Turn off splice by default
2023-09-07 14:17:39 -04:00
dyhkwong 7264750e28 fix typo in default.go 2023-09-07 12:28:55 -04:00
dyhkwong b8bd243df5
Fix buffer.UDP destination override (#2356) 2023-08-29 07:12:36 +00:00
cty b24a4028f1
fix(app/router): fixed a bug in geoip matching with refactoring (#2489)
* Refactor the IP address matching with netipx library
* Add a regression test for previous bug

Fixes https://github.com/XTLS/Xray-core/issues/1933

---------

Co-authored-by: Loyalsoldier <10487845+Loyalsoldier@users.noreply.github.com>
2023-08-26 15:11:37 +00:00
hax0r31337 f67167bb3b refactor(deps): replace github.com/golang/protobuf with google.golang.org/protobuf 2023-08-10 10:43:27 -04:00
cty123 7aeca33729 fix: revert previous change on IsValid() function; add validation in getUoTConnection(); 2023-07-19 15:53:01 -04:00
yuhan6665 a6c5c57930
Support regex matching with attr (#2258)
* Support regex matching with attr

* Add test case

* Optimizing regex parsing at core start

* simpliy
2023-06-27 08:04:09 +00:00
RPRX ee21763928 Run "go fmt ./..." 2023-06-18 09:46:57 -04:00
RPRX 62e881b01a
5*60 -> 2*60 2023-06-18 15:33:30 +00:00
yuhan6665 bf4b1fab3c Simplify http attrabute matching
In the past, we use Starlark script, it is over engineered and barely used.
By switching to simple key value string contains logic we can reduce core size about 0.7MB
2023-06-12 10:25:45 -04:00
yuhan6665 d11d72be6c Update proto file and fix protoc version parsing
The new protoc cli return version v23.1,
so we parse the file version v4.23.1 without "4."
2023-06-11 13:36:06 -04:00
yuhan6665 a4e80f01e4 Add tls serverName to DoQ 2023-06-04 08:45:38 -04:00
dependabot[bot] 86b4b81f1d Bump github.com/quic-go/quic-go from 0.34.0 to 0.35.1
Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.34.0 to 0.35.1.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md)
- [Commits](https://github.com/quic-go/quic-go/compare/v0.34.0...v0.35.1)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-01 18:23:56 -04:00
Zeyu Chen bfd5da2f00 fix: dns empty response 2023-05-01 10:19:50 -04:00
世界 18e5b0963f
Update dependencies 2023-04-23 19:32:07 +08:00
RPRX 06c9e50c52
Add "xudpProxyUDP443" to Mux config & XUDP rejects UDP/443 traffic by default (client side, excluding reverse proxy) 2023-04-14 22:51:18 +00:00
RPRX 24a2be43ef
Replace "only" with "xudpConcurrency" in Mux config 2023-04-10 10:36:07 +08:00
RPRX 29d7865d78
Refine "only" in Mux config 2023-04-10 10:15:16 +08:00
RPRX be23d5d3b7
XUDP protocol: Add Global ID & UoT Migration
The first UoT protocol that supports UoT Migration
Thank @yuhan6665 for testing
2023-04-06 10:21:35 +00:00
世界 f57ec13880
Update UoT protocol 2023-03-17 13:17:08 +08:00
RPRX f176ec54ee
v1.7.3 2023-02-02 05:50:21 +00:00
RPRX b70912799b
Generate *.pb.go files with protoc v3.21.12
https://github.com/protocolbuffers/protobuf/releases/tag/v21.12
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
go run ./infra/vprotogen
2023-01-30 04:35:30 +00:00
yuhan6665 c4fbdf1b78 Run core/format.go 2022-12-25 19:47:53 -05:00
yuhan6665 8117b66949 Generate all protos 2022-10-10 13:17:32 -04:00
yuhan6665 debd2e3ba8 Remove compatibility code
The minimum support go version is already 1.18
2022-09-16 20:39:07 -04:00
Mocking 4140bcd11a Enhancement of "redirect" function, adding support for MacOS
Added the function of "MacOS" FreeBSD firewall traffic forwarding and resolving destination address
example:
"inbounds": [
{
"listen": "127.0.0.1",
"port": 1122,
"protocol": "dokodemo-door",
"tag": "dokodemo",
"settings": {
"network": "tcp",
"followRedirect": true,
"userLevel": 0
},
"streamSettings": {
"sockopt": {
"tproxy": "Redirect"
}
}
}
]

还原#1189 提交
2022-08-22 10:33:58 -04:00
S-Mocking 59602db02d
Add "tproxy" option (#1189)
* Add "tproxy" option
Added the function of "MacOS" FreeBSD firewall traffic forwarding and resolving destination address
example:
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1122,
      "protocol": "dokodemo-door",
      "tag": "dokodemo",
      "settings": {
        "network": "tcp",
        "followRedirect": true,
        "userLevel": 0
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "pf"
        }
      }
    }
  ]

* Add "tproxy" option
Added the function of "MacOS" FreeBSD firewall traffic forwarding and resolving destination address
example:
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1122,
      "protocol": "dokodemo-door",
      "tag": "dokodemo",
      "settings": {
        "network": "tcp",
        "followRedirect": true,
        "userLevel": 0
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "pf"
        }
      }
    }
  ]

* Add "tproxy" option
Added the function of "MacOS" FreeBSD firewall traffic forwarding and resolving destination address
example:
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1122,
      "protocol": "dokodemo-door",
      "tag": "dokodemo",
      "settings": {
        "network": "tcp",
        "followRedirect": true,
        "userLevel": 0
      },
      "streamSettings": {
        "sockopt": {
          "tproxy": "pf"
        }
      }
    }
  ]

Co-authored-by: Mocking <fanhaiwang0817@gmail.com>
2022-08-20 09:02:18 -04:00
yuhan6665 5e323958b6 Unify dns log 2022-07-24 23:54:58 -04:00
世界 c3505632fd
Add udp over tcp support for shadowsocks-2022 2022-06-01 11:49:02 +08:00
世界 6f93ef7736
Remove useless error log 2022-06-01 11:11:53 +08:00
世界 398375d76f
Reformat code (quic sniffers) 2022-05-24 06:57:16 +08:00
yuhan6665 3f64f3206c
Quic sniffer (#1074)
* Add quic sniffer

* Fix quic sniffer

* Add uTP sniffer

* rename buf pool membership status to unmanaged

* rename buf type adaptor into FromBytes

Co-authored-by: 世界 <i@sekai.icu>
Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
2022-05-22 23:48:10 -04:00
世界 f046feb9ca
Reformat code 2022-05-18 15:29:01 +08:00
pocketW dcba88e511 fix fakedns is nil 2022-04-30 11:21:23 -04:00
pocketW 244db57398 fix proto file name conflict by adding package name 2022-04-28 22:45:04 -04:00
pocketW 3bfd6853f4 Fix memory leak caused by requiring component. 2022-04-28 10:46:56 -04:00
yuhan6665 b413066012
Fakedns fix xUDP destination override (#1011)
* Fix UDP destination override

* Fix code style

* Fix fakedns object init

Do type convertion at runtime in case if user don't use fakedns in config.
Since dispatcher now depend on fakedns object, move the injection order of
fakedns to top (As a temporary solution)

* Amend logic for handing fakedns client

A map is used by server side when client turn on fakedns
Client will send domain address in the buffer.UDP.Address, server record all possible target IP addrs.
When target replies, server will restore the domain and send back to client.

Co-authored-by: hmol233 <82594500+hmol233@users.noreply.github.com>
2022-04-23 19:24:46 -04:00
yuhan6665 4fb4dacae7 Reapply optimized log 2022-04-15 18:42:17 -04:00
yuhan6665 393d211d1e Rename quic session to connection
Co-authored-by: 秋のかえで <autmaple@protonmail.com>
2022-04-09 00:48:02 -04:00