Closed donaldzou closed 2 months ago
Forgot to mention... The issue I'm having is, I have a VM running locally on 192.168.64.2
and is using bridge mode for internet connection. After I connected Brook GUI (macOS), I can no longer access the VM via IP
There is a built-in module: Bypass Geo
, it contains ZZ
. All private IPs are ZZ
. BTW, using m.ipaddress is also possible, but the definition of address(m.ipaddress or m.domainaddress) includes both the host and port. For example, 1.1.1.1:443, or google.com:443.
Sorry for the lack of clarity in the documentation, I think I should improve it.
Test:
nami install httpserver
, httpserver -l :8080
curl -I http://192.168.3.160:8080
, success.I have no tested it on M1 Mac, because I have not installed VMware Fusion on my m1 mac, I believe the result should be the same?
In Brook GUI, scripts are abstracted into modules, and it will automatically combine _header.tengo
and _footer.tengo
, so you only need to write the module itself.
modules = append(modules, {
// If you want to predefine multiple brook links, and then programmatically specify which one to connect to, then define `brooklinks` key a function
brooklinks: func(m) {
// Please refer to the example in `brooklinks.tengo`
},
// If you want to intercept and handle a DNS query, then define `dnsquery` key a function, `m` is the `in_dnsquery`
dnsquery: func(m) {
// Please refer to the example in `block_aaaa.tengo`
},
// If you want to intercept and handle an address, then define `address` key a function, `m` is the `in_address`
address: func(m) {
// Please refer to the example in `block_google_secure_dns.tengo`
},
// If you want to intercept and handle a http request, then define `httprequest` key a function, `request` is the `in_httprequest`
httprequest: func(request) {
// Please refer to the example in `ios_app_downgrade.tengo` or `redirect_google_cn.tengo`
},
// If you want to intercept and handle a http response, then define `httpresponse` key a function, `request` is the `in_httprequest`, `response` is the `in_httpresponse`
httpresponse: func(request, response) {
// Please refer to the example in `response_sample.tengo`
}
})
In your case, for example:
modules = append(modules, {
address: func(m) {
if m.ipaddress {
text := import("text")
if text.has_prefix(m.ipaddress, "192.168.64.2") { // because m.ipaddress contains port, such as 192.168.64.2:80
return { bypass: true }
}
}
}
})
If you are using tun2brook, you can combine multiple modules into a complete script in the following way. For example:
cat _header.tengo > my.tengo
cat block_google_secure_dns.tengo >> my.tengo
cat block_aaaa.tengo >> my.tengo
cat _footer.tengo >> my.tengo
Yay! Thank you for the quick response, it works now. I think the tengo script above is working, it was just the network configuration I had was "Shared" but not "Bridge". Tysm!
Haven't use Brook in a long time and saw the huge changes and I loved it! Just wondering how can I bypass local IPs? I tried to write a module but it doesn't seem to be working:
Plz help :) Thank you!