mirror of
https://github.com/e1732a364fed/v2ray_simple.git
synced 2025-12-24 13:27:56 +08:00
31 lines
629 B
Go
31 lines
629 B
Go
package http
|
|
|
|
import (
|
|
"github.com/BurntSushi/toml"
|
|
"github.com/e1732a364fed/v2ray_simple/netLayer"
|
|
"github.com/e1732a364fed/v2ray_simple/proxy"
|
|
)
|
|
|
|
func SetupTmpProxyServer() (clientEndInServer proxy.Server, proxyUrl string, err error) {
|
|
const tempClientConfStr = `
|
|
protocol = "http"
|
|
`
|
|
|
|
var lc proxy.ListenConf
|
|
_, err = toml.Decode(tempClientConfStr, &lc)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
clientEndInServer, err = proxy.NewServer(&lc)
|
|
if err != nil {
|
|
return
|
|
}
|
|
listenAddrStr := netLayer.GetRandLocalPrivateAddr(true, false)
|
|
clientEndInServer.SetAddrStr(listenAddrStr)
|
|
|
|
proxyUrl = "http://" + listenAddrStr
|
|
|
|
return
|
|
}
|