Created
November 18, 2019 08:52
-
-
Save luoqeng/abdc0e966d31fab4e49551e39ff79b05 to your computer and use it in GitHub Desktop.
proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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