mirror of
https://github.com/wweir/sower.git
synced 2024-04-21 12:42:15 +00:00
31 lines
677 B
Go
31 lines
677 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
|
|
"github.com/wweir/sower/conf"
|
|
"github.com/wweir/sower/proxy"
|
|
)
|
|
|
|
func main() {
|
|
if conf.Server.Upstream != "" {
|
|
proxy.StartServer(conf.Server.Upstream, conf.Password,
|
|
conf.Server.CertFile, conf.Server.KeyFile, conf.Server.CertEmail)
|
|
}
|
|
|
|
if conf.Client.Address != "" {
|
|
if conf.Client.DNS.ServeIP != "" {
|
|
go proxy.StartDNS(conf.Client.DNS.ServeIP, conf.Client.DNS.Upstream)
|
|
}
|
|
|
|
proxy.StartClient(conf.Password, conf.Client.Address, conf.Client.HTTPProxy.Address,
|
|
conf.Client.DNS.ServeIP, conf.Client.Router.PortMapping)
|
|
}
|
|
|
|
if conf.Server.Upstream == "" && conf.Client.Address == "" {
|
|
fmt.Println()
|
|
flag.Usage()
|
|
}
|
|
}
|