mps

morphux package server
Log | Files | Refs | Submodules | README | LICENSE | git clone https://git.ne02ptzero.me/git/mps

commit 6af5caa012472bebb8954e35a80a5f0e64ef3418
parent 481b4ad40fb7807d144f5133bc6c9149fc964d7e
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue,  2 May 2017 11:38:11 +0200

Fix(Main): Now enabling TLS by default, unless instructed otherwhise via -notls flag:

Update README documentation
Update tests/ submodule for a fix in a Macro

Diffstat:
MREADME.md | 4+---
Mmain.go | 19++++++++++++-------
2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/README.md b/README.md @@ -57,9 +57,7 @@ mps usage : mps host:port -pub string: public key path - -tls: use or not tls + -notls: Do not use tls ``` -note: to activate TLS support you have to specify a private and a public key - # Documentation diff --git a/main.go b/main.go @@ -34,11 +34,11 @@ import ( func main() { - databasePtr := flag.String("db", "", "a sqlite database") + databasePtr := flag.String("db", "", "A sqlite database") - tlsPtr := flag.Bool("tls", false, "use or not tls") - PublicKeyPtr := flag.String("pub", "", "public key path") - PrivateKeyPtr := flag.String("priv", "", "private key path") + tlsPtr := flag.Bool("notls", false, "Do not use tls") + PublicKeyPtr := flag.String("pub", "", "Public key path") + PrivateKeyPtr := flag.String("priv", "", "Private key path") flag.Parse() @@ -55,7 +55,7 @@ func main() { var listener net.Listener - if *tlsPtr == true && *PrivateKeyPtr != "" && *PublicKeyPtr != "" { + if *tlsPtr == false && *PrivateKeyPtr != "" && *PublicKeyPtr != "" { cert, err := tls.LoadX509KeyPair(*PrivateKeyPtr, *PublicKeyPtr) if err != nil { log.Fatalf("server: loadkeys: %s", err) @@ -67,7 +67,12 @@ func main() { listener, err = tls.Listen("tcp", flag.Args()[0], &config) } else { - listener, err = net.Listen("tcp", flag.Args()[0]) + if (*tlsPtr == true) { + listener, err = net.Listen("tcp", flag.Args()[0]) + } else { + fmt.Println("Cannot launch server without tls support") + os.Exit(1) + } } if listener == nil { @@ -81,7 +86,7 @@ func main() { } defer listener.Close() - if *tlsPtr { + if *tlsPtr == false { fmt.Println("Listening on "+flag.Args()[0], "with TLS support") } else { fmt.Println("Listening on " + flag.Args()[0])