2016-01-27 21:24:36 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"sync"
|
2016-02-03 18:46:24 +08:00
|
|
|
|
2016-02-18 18:24:48 +08:00
|
|
|
"github.com/fatedier/frp/models/client"
|
2016-02-18 16:56:55 +08:00
|
|
|
"github.com/fatedier/frp/utils/log"
|
2016-01-27 21:24:36 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2016-02-18 18:24:48 +08:00
|
|
|
err := client.LoadConf("./frpc.ini")
|
2016-01-27 21:24:36 +08:00
|
|
|
if err != nil {
|
|
|
|
os.Exit(-1)
|
|
|
|
}
|
|
|
|
|
2016-02-18 18:24:48 +08:00
|
|
|
log.InitLog(client.LogWay, client.LogFile, client.LogLevel)
|
2016-01-27 21:24:36 +08:00
|
|
|
|
|
|
|
// wait until all control goroutine exit
|
|
|
|
var wait sync.WaitGroup
|
2016-02-18 18:24:48 +08:00
|
|
|
wait.Add(len(client.ProxyClients))
|
2016-01-27 21:24:36 +08:00
|
|
|
|
2016-02-18 18:24:48 +08:00
|
|
|
for _, client := range client.ProxyClients {
|
2016-01-27 21:24:36 +08:00
|
|
|
go ControlProcess(client, &wait)
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Info("Start frpc success")
|
|
|
|
|
|
|
|
wait.Wait()
|
|
|
|
log.Warn("All proxy exit!")
|
|
|
|
}
|