1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Added force wss flag

Former-commit-id: f5be76c42fcbac8ad02fdf3f33fbb778d708a572 [formerly c0ccaf9c27ad8f4f61f73cc49051e5720226cb78] [formerly 3339f1503f89edc1ce65f71ac986cfc06d4a41ac [formerly 3c2a64ec09]]
Former-commit-id: ac62f91a7c5dab5c7a299bbd471f9862ebd048b0 [formerly 94ecb0cebb996c6ed88412c70e45a72e9fd322f0]
Former-commit-id: 2448c0842558e7f04db3b08923b2cb458e767a53
This commit is contained in:
root 2016-03-27 11:54:59 -04:00
parent 9d0d28b663
commit a53c5d47b1

View File

@ -31,6 +31,7 @@ var RuntimeArgs struct {
SourcePath string SourcePath string
AdminKey string AdminKey string
Socket string Socket string
ForceWss bool
} }
var VersionNum string var VersionNum string
@ -45,6 +46,7 @@ func main() {
flag.StringVar(&RuntimeArgs.ServerCRT, "crt", "", "location of ssl crt") flag.StringVar(&RuntimeArgs.ServerCRT, "crt", "", "location of ssl crt")
flag.StringVar(&RuntimeArgs.ServerKey, "key", "", "location of ssl key") flag.StringVar(&RuntimeArgs.ServerKey, "key", "", "location of ssl key")
flag.StringVar(&RuntimeArgs.WikiName, "w", "cowyo", "custom name for wiki") flag.StringVar(&RuntimeArgs.WikiName, "w", "cowyo", "custom name for wiki")
flag.BoolVar(&RuntimeArgs.ForceWss, "e", false, "force encrypted sockets")
dumpDataset := flag.Bool("dump", false, "flag to dump all data to 'dump' directory") dumpDataset := flag.Bool("dump", false, "flag to dump all data to 'dump' directory")
flag.CommandLine.Usage = func() { flag.CommandLine.Usage = func() {
fmt.Println(`cowyo (version ` + VersionNum + `): A Websocket Wiki and Kind Of A List Application fmt.Println(`cowyo (version ` + VersionNum + `): A Websocket Wiki and Kind Of A List Application
@ -113,6 +115,9 @@ Options:`)
r.RunTLS(RuntimeArgs.Port, RuntimeArgs.ServerCRT, RuntimeArgs.ServerKey) r.RunTLS(RuntimeArgs.Port, RuntimeArgs.ServerCRT, RuntimeArgs.ServerKey)
} else { } else {
RuntimeArgs.Socket = "ws" RuntimeArgs.Socket = "ws"
if RuntimeArgs.ForceWss {
RuntimeArgs.Socket = "wss"
}
fmt.Println("--------------------------") fmt.Println("--------------------------")
fmt.Println("cowyo (version " + VersionNum + ") is up and running on http://" + RuntimeArgs.ExternalIP) fmt.Println("cowyo (version " + VersionNum + ") is up and running on http://" + RuntimeArgs.ExternalIP)
fmt.Println("Admin key: " + RuntimeArgs.AdminKey) fmt.Println("Admin key: " + RuntimeArgs.AdminKey)