mirror of
https://github.com/luscis/openlan.git
synced 2025-10-16 14:00:42 +08:00
fea: openacce for ceci name.
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
|
||||
"github.com/luscis/openlan/pkg/access"
|
||||
"github.com/luscis/openlan/pkg/config"
|
||||
@@ -12,17 +13,28 @@ import (
|
||||
func main() {
|
||||
mode := "http"
|
||||
conf := ""
|
||||
flag.StringVar(&mode, "mode", "http", "Proxy mode for http, socks, tcp and access")
|
||||
flag.StringVar(&mode, "mode", "http", "Proxy mode for http, socks, tcp and name")
|
||||
flag.StringVar(&conf, "conf", "ceci.yaml", "The configuration file")
|
||||
flag.Parse()
|
||||
|
||||
if !(mode == "http" || mode == "socks" || mode == "tcp" || mode == "name") {
|
||||
libol.Warn("Ceci: not support mode:%s", mode)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
libol.PreNotify()
|
||||
if mode == "http" {
|
||||
c := &config.HttpProxy{Conf: conf}
|
||||
|
||||
if mode == "name" {
|
||||
c := &config.Point{
|
||||
RequestAddr: true,
|
||||
Terminal: "off",
|
||||
Conf: conf,
|
||||
}
|
||||
if err := c.Initialize(); err != nil {
|
||||
return
|
||||
}
|
||||
p := proxy.NewHttpProxy(c, nil)
|
||||
p := access.NewPoint(c)
|
||||
p.Initialize()
|
||||
libol.Go(p.Start)
|
||||
} else if mode == "socks" {
|
||||
c := &config.SocksProxy{Conf: conf}
|
||||
@@ -38,19 +50,15 @@ func main() {
|
||||
}
|
||||
p := proxy.NewTcpProxy(c)
|
||||
libol.Go(p.Start)
|
||||
} else if mode == "access" {
|
||||
c := &config.Point{
|
||||
RequestAddr: true,
|
||||
Terminal: "off",
|
||||
Conf: conf,
|
||||
}
|
||||
} else {
|
||||
c := &config.HttpProxy{Conf: conf}
|
||||
if err := c.Initialize(); err != nil {
|
||||
return
|
||||
}
|
||||
p := access.NewPoint(c)
|
||||
p.Initialize()
|
||||
p := proxy.NewHttpProxy(c, nil)
|
||||
libol.Go(p.Start)
|
||||
}
|
||||
|
||||
libol.SdNotify()
|
||||
libol.Wait()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user