mirror of
https://github.com/luscis/openlan.git
synced 2025-10-05 08:36:59 +08:00
fea: ceci support tcp proxy.
This commit is contained in:
@@ -1,18 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
|
||||
"github.com/luscis/openlan/pkg/config"
|
||||
"github.com/luscis/openlan/pkg/libol"
|
||||
"github.com/luscis/openlan/pkg/proxy"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := config.NewHttpProxy()
|
||||
if c != nil {
|
||||
libol.PreNotify()
|
||||
h := proxy.NewHttpProxy(c, nil)
|
||||
libol.SdNotify()
|
||||
libol.Go(h.Start)
|
||||
libol.Wait()
|
||||
mode := "http"
|
||||
conf := ""
|
||||
flag.StringVar(&mode, "mode", "http", "Proxy mode for tcp or http")
|
||||
flag.StringVar(&conf, "conf", "ceci.json", "The configuration file")
|
||||
flag.Parse()
|
||||
|
||||
libol.PreNotify()
|
||||
if mode == "http" {
|
||||
c := &config.HttpProxy{Conf: conf}
|
||||
if err := c.Initialize(); err != nil {
|
||||
return
|
||||
}
|
||||
p := proxy.NewHttpProxy(c, nil)
|
||||
libol.Go(p.Start)
|
||||
|
||||
} else {
|
||||
c := &config.TcpProxy{Conf: conf}
|
||||
if err := c.Initialize(); err != nil {
|
||||
return
|
||||
}
|
||||
p := proxy.NewTcpProxy(c)
|
||||
libol.Go(p.Start)
|
||||
|
||||
}
|
||||
libol.SdNotify()
|
||||
libol.Wait()
|
||||
}
|
||||
|
Reference in New Issue
Block a user