diff --git a/server/main.go b/server/main.go index db215c4..49890ac 100644 --- a/server/main.go +++ b/server/main.go @@ -1,9 +1,8 @@ package main import ( - "errors" "flag" - "log" + "fmt" ) type Server struct { @@ -12,12 +11,24 @@ type Server struct { cert *string } -func (server *Server) Start() error { - return errors.New("server start to be implemented") +func (server *Server) Start() { + + if *server.tls && (len(*server.key) <= 0 || len(*server.cert) <= 0) { + fmt.Println("Must provide key and certificate file paths for TLS mode.") + return + } + + if *server.tls { + fmt.Println("TLS mode activated...") + } else { + fmt.Println("Normal TCP mode...") + } + + // Listen to connection } func main() { - tls := flag.Bool("tls", false, "Start the server in TLS mode.") + tls := flag.Bool("tls", false, "Start the server in TLS mode. Default is false") key := flag.String("key", "", "The private key file path.") cert := flag.String("cert", "", "The signed certificate file path.") @@ -29,9 +40,5 @@ func main() { cert: cert, } - err := server.Start() - - if err != nil { - log.Fatal(err) - } + server.Start() }