Code Monkey home page Code Monkey logo

Comments (5)

lls275 avatar lls275 commented on May 24, 2024

I'm desperately asking for help right now, I can only hope for now

from gomitmproxy.

lls275 avatar lls275 commented on May 24, 2024

I extracted a simple example of the core http proxy of the gomitmproxy, which is printed normally in http

func main() {
	listenAddr := &net.TCPAddr{
		IP:   net.IPv4(0, 0, 0, 0),
		Port: 8080,
	}
	l, err := net.ListenTCP("tcp", listenAddr)
	if err != nil {
	}
	log.Printf("start listening to %s", l.Addr())

	conn, err := l.Accept()
	log.Printf("remote addr is %s", conn.RemoteAddr())
	log.Printf("local addr is %s", conn.LocalAddr())

	localRW := bufio.NewReadWriter(bufio.NewReader(conn), bufio.NewWriter(conn))

	var req *http.Request
	reqc := make(chan *http.Request, 1)
	errc := make(chan error, 1)

	go func() {
		r, err := http.ReadRequest(localRW.Reader)
		if err != nil {
			errc <- err
			return
		}
		reqc <- r
	}()

	req = <-reqc

	log.Println(req)
}

It can be obtained normally, but if the proxy is transparent, how should this code be changed?

2022/04/07 15:52:09 start listening to [::]:8080
2022/04/07 15:52:11 remote addr is 192.168.1.23:59812
2022/04/07 15:52:11 local addr is 192.168.1.23:8080
2022/04/07 15:52:11 &{CONNECT //www.google.com:443 HTTP/1.1 1 1 map[Proxy-Connection:[keep-alive] User-Agent:[Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4774.0 Safari/537.36]] {} <nil> 0 [] false www.google.com:443 map[] map[] <nil> map[]  www.google.com:443 <nil> <nil> <nil> <nil>}

from gomitmproxy.

lls275 avatar lls275 commented on May 24, 2024

If the official can give a simple example of modification, it would be great, thank you very much

from gomitmproxy.

ameshkov avatar ameshkov commented on May 24, 2024

Well, the problem is that currently it simply does not support the transparent proxy approach, it expects to be used as a normal proxy. The code requires substantial changes to support this.

from gomitmproxy.

lls275 avatar lls275 commented on May 24, 2024

Well, the problem is that currently it simply does not support the transparent proxy approach, it expects to be used as a normal proxy. The code requires substantial changes to support this.

If you add a transparent proxy, roughly what you need to do? Is it first to initiate a CONNECT request to gomitmproxy through TCP for iptable traffic, when encountering HTTPS traffic? It seems that if a third-party transparent proxy (support upstream is HTTP https://github.com/xiqingping/transproxy) is connected between iptable and gomitmproxy, it can be used, but I want to integrate the transparent proxy function into gomitmproxy (this way I don’t need to open another program), but due to my limited personal ability, I can’t implement it yet. Can the author provide some ideas?

from gomitmproxy.

Related Issues (16)

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.