Skip to content

Instantly share code, notes, and snippets.

@luoqeng
Created November 18, 2019 08:52
Show Gist options
  • Save luoqeng/abdc0e966d31fab4e49551e39ff79b05 to your computer and use it in GitHub Desktop.
Save luoqeng/abdc0e966d31fab4e49551e39ff79b05 to your computer and use it in GitHub Desktop.
proxy
package main
import (
"io"
"net"
)
func main() {
s, _ := net.Listen("tcp", ":8080")
for {
l, _ := s.Accept()
r, _ := net.Dial("tcp", "localhost:8081")
go io.Copy(l, r)
go io.Copy(r, l)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment