telebit/vpn-server.go
Henry Camacho 6d172c2404 Continued restructuring isolating network interfaces
- each listener has its own MUX and handlers that are separate from global.
- the external handler will take a request from an external client destine for a WSS.
- the request is output on stdio.

My Questions are this point is this:
- do I just send the request down towards the WSS, or do I have to pack it?
- what is the response I will get back from the tunnel client?  That seems it must be in a packer.
- I’ve been going though the source I need to be pointed in the right direction.
2017-02-08 21:08:53 -06:00

59 líneas
1.5 KiB
Go

package main
import (
"flag"
"io"
"log"
"os"
"time"
"git.daplie.com/Daplie/go-rvpn-server/logging"
)
const (
// Time allowed to write a message to the peer.
writeWait = 10 * time.Second
// Time allowed to read the next pong message from the peer.
pongWait = 60 * time.Second
// Send pings to peer with this period. Must be less than pongWait.
pingPeriod = (pongWait * 9) / 10
// Maximum message size allowed from peer.
maxMessageSize = 512
)
var (
//Info ..
loginfo *log.Logger
logfatal *log.Logger
logFlags = log.Ldate | log.Lmicroseconds | log.Lshortfile
argServerBinding = flag.String("server-port", "127.0.0.1:3502", "server Bind listener")
argServerAdminBinding = flag.String("admin-server-port", "127.0.0.2:8000", "admin server Bind listener")
argServerExternalBinding = flag.String("external-server-port", "127.0.0.1:8080", "external server Bind listener")
connectionTable *ConnectionTable
secretKey = "abc123"
)
func logInit(infoHandle io.Writer) {
loginfo = log.New(infoHandle, "INFO: ", logFlags)
logfatal = log.New(infoHandle, "FATAL : ", logFlags)
}
func main() {
logging.Init(os.Stdout, logFlags)
linfo, lfatal := logging.Get()
loginfo = linfo
logfatal = lfatal
loginfo.Println("startup")
flag.Parse()
connectionTable = newConnectionTable()
go connectionTable.run()
go launchClientListener()
go launchWebRequestExternalListener()
launchAdminListener()
}