Comments (16)
protectFd := func(s VpnService, fd int) error {
if s.Protect(fd) {
return nil
} else {
return errors.New(fmt.Sprintf("failed to protect fd %v", fd))
}
}
netCtlr := func(network, address string, fd uintptr) error {
return protectFd(vpnService, int(fd))
}
net.DefaultResolver = &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, addr string) (net.Conn, error) {
dialer := &net.Dialer{
DualStack: true,
Control: func(network, address string, c syscall.RawConn) error {
return c.Control(func(fd uintptr) {
netCtlr(network, address, fd)
})
},
}
return dialer.DialContext(ctx, network, localDNS)
},
}
from kitsunebi-android.
great thanks. https://github.com/rurirei/go-libv2ray/commit/9f1e33e
from kitsunebi-android.
great thanks. rurirei/go-libv2ray@9f1e33e
sorry for asking. how do i forward dns traffic to v2ray inbound from tun2socks
? i set net.defaultResolver with addr 127.0.0.1:10088 (localDns string) and set Dokodemo-Door inbound (listen on port 10088, address 8.8.8.8 port 53)
PrepareDomain err: lookup server.address.domain on [::1]:53: read udp 127.0.0.1:48822->127.0.0.1:10088: read: connection refused
from kitsunebi-android.
I don't remember the details, but I never use dokodemo-door to handle DNS, instead you could route DNS traffic to a DNS outbound:
{
"inboundTag": ["tun2socks"],
"network": "udp",
"port": 53,
"outboundTag": "dns-out",
"type": "field"
},
from kitsunebi-android.
though what is inbound tun2socks
, i did thought it to Dokodemo inbound.
from kitsunebi-android.
You attach a ctx with a "tun2socks" tag when dialing connections with a V instance, then v2ray will recognize those traffic are coming from "tun2socks":
ctx = vsession.ContextWithInbound(ctx, &vsession.Inbound{Tag: "tun2socks"})
c, err := vcore.Dial(ctx, h.v, dest)
from kitsunebi-android.
You attach a ctx with a "tun2socks" tag when dialing connections with a V instance, then v2ray will recognize those traffic are coming from "tun2socks":
ctx = vsession.ContextWithInbound(ctx, &vsession.Inbound{Tag: "tun2socks"})
c, err := vcore.Dial(ctx, h.v, dest)
thanks for reply, how to handle dns traffic from net.DefaultResolver with vcore.Dial(ctx, h.v, dest) then?
from kitsunebi-android.
The fd
is protected as you can see in the code snippet above, protected traffic won't go into v2ray, that's why it's called local dns
.
from kitsunebi-android.
so i was thought meanings of local dns
on anything wrong.
from kitsunebi-android.
android:defaultValue="223.5.5.5"
android:key="@string/local_dns"
android:summary="The DNS server that will be used by the freedom outbound (in case you are using AsIs as the freedom outbound's domain strategy) or for resolving domain names of outbound servers, and these DNS requests won't be logged to proxy log. Moreover, non A/AAAA DNS queries from the OS will also be sent to this DNS server, they will be treated as normal UDP traffic."
android:title="Local DNS"
sorry but could you give some more function explaination of Local DNS?
from kitsunebi-android.
i was misunderstood this to the similar to tun2socks --dnsgw 127.0.0.1:10088
.
so i was thought meanings of
local dns
on anything wrong.
from kitsunebi-android.
I don't remember the details, but I never use dokodemo-door to handle DNS, instead you could route DNS traffic to a DNS outbound:
{ "inboundTag": ["tun2socks"], "network": "udp", "port": 53, "outboundTag": "dns-out", "type": "field" },
but local dns traffic won't into v2ray..
from kitsunebi-android.
It means DNS traffic initiated from this resolver will definitely go into the internet directly, no proxying, that's it.
net.DefaultResolver = &net.Resolver{
I think what you missed here is only the VPN itself (only the Go code) will use this resolver. And you still need to handle DNS traffic coming from other applications, those traffic should be routed to a DNS outbound.
from kitsunebi-android.
only the VPN itself (only the Go code) will use this resolver
this is exactly i missed.
need to handle DNS traffic coming from other applications
i dont know how should to done this
those traffic should be routed to a DNS outbound
v2ray dns handle its dns-outbound if IP query. is this "Moreover, non A/AAAA DNS queries from the OS will also be sent to this DNS server"?
from kitsunebi-android.
v2ray dns handle its dns-outbound if IP query. is this "Moreover, non A/AAAA DNS queries from the OS will also be sent to this DNS server"?
I forgot, I'm not sure about this without looking into the code.
from kitsunebi-android.
gave this up.
from kitsunebi-android.
Related Issues (20)
- Kitsunebi没使用AES指令集? HOT 1
- 源码中的软件使用时导入ss配置连接不上服务器
- 即使配置「繞過局域網」,也不能Miracast投影
- 一个bug
- 能否支持App内导入证书?
- IP4+IP6问题
- [功能请求]一键开关
- github首页上搜索“kitsunebi”竟然无任何结果
- 科学上网
- 希望能将geosite.dat和geoip.dat放在sdcard目录下,这样安卓可以借助一些第三方功能实现自动更新这两个dat文件
- Please update the v2ray-core version
- 希望可以 Donate 以支持继续发开
- 有人能简单定制个客户端么 HOT 1
- 请问怎么使用订阅功能
- ……
- iOS还更新吗,kitsunebi
- tun2socks完整代码 HOT 1
- 节点名有中文报错v2ray配置文件不正确 HOT 1
- error 521
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kitsunebi-android.