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

使用grpc API添加vless+reality+version入站协议,运行时报错failed to dial dest: dial: unknown network求助 #179

Closed
noirety opened this issue Mar 30, 2024 · 2 comments

Comments

@noirety
Copy link

noirety commented Mar 30, 2024

调用api的go语言代码,调用完之后没有报错,服务端36804端口也成功开放:


func addInbound2(client command.HandlerServiceClient) error {

	_, err := client.AddInbound(context.Background(), &command.AddInboundRequest{
		Inbound: &core.InboundHandlerConfig{
			Tag: "vlessRealityVision",
			ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{
				// 监听端口 12345
				PortList: &net.PortList{
					Range: []*net.PortRange{
						{
							From: 36804,
							To:   36804,
						},
					},
				},
				// 监听地址, 默认0.0.0.0
				Listen: net.NewIPOrDomain(net.AnyIP),
				// 传输方式
				StreamSettings: &internet.StreamConfig{
					/*
						传输方式名称
						请自行在 github.com/xtls/xray-core/transport/internet/config.pb.go 中寻找支持的协议
						截至 1.3.0 目前支持
						"TCP",
						"UDP",
						"MKCP",
						"WebSocket",
						"HTTP",
						"DomainSocket"
						使用时请一律小写

					*/
					ProtocolName: "tcp",

					/*
						传输层加密
						请在 github.com/xtls/xray-core/transport/internet/ 中选择合适的传输层加密方式
						截至1.3.0 目前支持
						TLS
						XTLS
						留空即为None
					*/
					SecurityType: serial.GetMessageType(&reality.Config{}),
					SecuritySettings: []*serial.TypedMessage{
						serial.ToTypedMessage(&reality.Config{
							Dest:       "itunes.apple.com:443",
							ServerName: "itunes.apple.com",
							PrivateKey: []byte("oIT_ske_9JWJthHLAegEpo9OvTBbzAIfIqkPpc8w_VM"),
							ShortId:    []byte("a5dce0cc"),
						}),
					},
					TransportSettings: []*internet.TransportConfig{
						{
							ProtocolName: "tcp",
							Settings:     serial.ToTypedMessage(&tcp.Config{AcceptProxyProtocol: false}),
						},
					},
				},
				//// 流量探测
				SniffingSettings: &proxyman.SniffingConfig{
					Enabled:             true,
					DestinationOverride: []string{"http", "tls", "quic"},
				},
			}),
			/*
				代理设置, 请到 github.com/xtls/xray-core/proxy/ 寻找你想要添加的入站代理类型
				某些类型需要区分 Inbound 与 Outbound 的配置,
				需要区分使用 github.com/xtls/xray-core/proxy/PROXYTYPE/inbound/config.pb.go 中的 Config 结构
				无须区分的使用 github.com/xtls/xray-core/proxy/PROXYTYPE/config.pb.go 的 ServerConfig 结构
			*/
			ProxySettings: serial.ToTypedMessage(&vlessInbound.Config{
				Clients: []*protocol.User{
					{
						Level: 0,
						Email: "[email protected]",
						Account: serial.ToTypedMessage(&vless.Account{
							Id:   "ba1e6c9d-825a-4129-bdf9-2f1d65f4d1db",
							Flow: "xtls-rprx-vision",
						}),
					},
				},
				Decryption: "none",
			}),
		},
	})

	return err
}

客户端配置:

  "outbounds": [
    {
      "tag": "proxy",
      "protocol": "vless",
      "settings": {
        "vnext": [
          {
            "address": "192.168.0.11",
            "port": 36804,
            "users": [
              {
                "id": "ba1e6c9d-825a-4129-bdf9-2f1d65f4d1db",
                "alterId": 0,
                "email": "[email protected]",
                "security": "auto",
                "encryption": "none",
                "flow": "xtls-rprx-vision"
              }
            ]
          }
        ]
      },
      "streamSettings": {
        "network": "tcp",
        "security": "reality",
        "realitySettings": {
          "serverName": "itunes.apple.com",
          "fingerprint": "chrome",
          "show": false,
          "publicKey": "dgQGrz0lH2HFX2U9VnHoMMAjkJE2XvKTlNUGANJPMCU",
          "shortId": "a5dce0cc",
          "spiderX": ""
        }
      },
      "mux": {
        "enabled": false,
        "concurrency": -1
      }
    }
}

运行时服务端报错信息:

2024/03/30 19:18:41 [Info] transport/internet/tcp: REALITY: failed to dial dest: dial: unknown network 
2024/03/30 19:18:42 [Info] transport/internet/tcp: REALITY: failed to dial dest: dial: unknown network 
2024/03/30 19:18:42 [Info] transport/internet/tcp: REALITY: failed to dial dest: dial: unknown network 
2024/03/30 19:18:43 [Info] transport/internet/tcp: REALITY: failed to dial dest: dial: unknown network 
2024/03/30 19:18:44 [Info] transport/internet/tcp: REALITY: failed to dial dest: dial: unknown network 

求大神们指导下是哪里写的不对,感激不尽。

@yuhan6665
Copy link
Member

Reality 那个 api 调用要设置一个 network tcp 我写测试的时候好像遇到过这个问题
XTLS/Xray-core@7729369#diff-617a957afcd7486a26c27d311c421c67543698c06e9dc859b59f5213336418ccR417

@noirety
Copy link
Author

noirety commented Mar 31, 2024

Reality 那个 api 调用要设置一个 network tcp 我写测试的时候好像遇到过这个问题 XTLS/Xray-core@7729369#diff-617a957afcd7486a26c27d311c421c67543698c06e9dc859b59f5213336418ccR417

已解决,感激不尽!

@noirety noirety closed this as completed Mar 31, 2024
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

No branches or pull requests

2 participants