Giter VIP home page Giter VIP logo

Comments (3)

donaldzou avatar donaldzou commented on June 16, 2024

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

from brook.

txthinking avatar txthinking commented on June 16, 2024

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:

  • A macOS intel (192.168.3.177)
  • Install Brook GUI on macOS
  • Install VMware Fusion on macOS
  • Install Ubuntu(192.168.3.160) on VMware Fusion with bridge network
  1. Brook GUI: Enable Bypass Geo module, and Connect
  2. Ubuntu: start a simple http server nami install httpserver, httpserver -l :8080
  3. macOS: connect to the http server: 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?


Brook GUI

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 }
            }
        }
    }
})

tun2brook

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

from brook.

donaldzou avatar donaldzou commented on June 16, 2024

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!

from brook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.