mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2026-04-22 23:57:20 +08:00
42 lines
812 B
Go
42 lines
812 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/Pinggy-io/pinggy-go/pinggy"
|
|
)
|
|
|
|
func main() {
|
|
tunType := os.Args[1]
|
|
address := os.Args[2]
|
|
|
|
log.SetFlags(log.Llongfile | log.LstdFlags)
|
|
|
|
config := pinggy.Config{
|
|
Type: pinggy.TunnelType(tunType),
|
|
TcpForwardingAddr: address,
|
|
|
|
//SshOverSsl: true,
|
|
//Stdout: os.Stderr,
|
|
//Stderr: os.Stderr,
|
|
}
|
|
|
|
if tunType == "http" {
|
|
hman := pinggy.CreateHeaderManipulationAndAuthConfig()
|
|
//hman.SetReverseProxy(address)
|
|
//hman.SetPassPreflight(true)
|
|
//hman.SetNoReverseProxy()
|
|
config.HeaderManipulationAndAuth = hman
|
|
}
|
|
|
|
pl, err := pinggy.ConnectWithConfig(config)
|
|
if err != nil {
|
|
log.Panicln(err)
|
|
}
|
|
log.Println("Addrs: ", pl.RemoteUrls())
|
|
//err = pl.InitiateWebDebug("localhost:3424")
|
|
//log.Println(err)
|
|
pl.StartForwarding()
|
|
}
|