Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(conf): add Windows support for Unix Domain Socket #2851

Merged
merged 1 commit into from
Dec 24, 2023

Conversation

yin1999
Copy link
Contributor

@yin1999 yin1999 commented Dec 24, 2023

Summary

add Windows support for Unix Domain Socket.

Supports

Windows Insider Build 17063 and later does support Unix Domain Socket, but the UDS check logic has blocked using UDS in windows.

Tests

config (yaml format):

log:
  loglevel: warning

inbounds:
  - listen: "C:\\Absolute-path\\to\\xray.sock"
    tag: xray
    protocol: http
    sniffing:
      enabled: true
      destOverride: ["http", "tls"]
    settings:
      auth: noauth
      allowTransparent: false

outbounds:
  - tag: freedom
    protocol: freedom

routing:
  domainStrategy: AsIs
  # all pass
  rules:
    - type: field
      inboundTag: xray
      outboundTag: freedom

Run curl (with PowerShell Core) to test the http proxy server:

curl -I --unix-socket 'C:\Absolute-path\to\xray.sock' -X connect http:/ --next https://www.baidu.com/

@Fangliding
Copy link
Member

@yin1999 It would be better add add a support check and return an error log if current version is not supported

@yin1999
Copy link
Contributor Author

yin1999 commented Dec 24, 2023

@yin1999 It would be better add add a support check and return an error log if current version is not supported

The original absolute path check method is only applicable to *nix, because the absolute path of Windows starts with the drive letter (or \\), so listenDS is always false when configuring Unix Domain socket on Windows.

Log with the build from main branch with the same configuration:

Xray 1.8.6 (Xray, Penetrates Everything.) Custom (go1.21.4 windows/amd64)
A unified platform for anti-censorship.
Failed to start: main: failed to load config files: [.\config.yaml] > infra/conf: unable to listen on domain address: xxxxx\Xray-core\build_assets\xray.sock

@yuhan6665 yuhan6665 merged commit b0bf0d7 into XTLS:main Dec 24, 2023
34 checks passed
@yuhan6665
Copy link
Member

I love it! Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants