Small tweaks

This commit is contained in:
raul 2024-05-14 15:59:23 +02:00
parent 93c76f4242
commit b2f9ff5016
3 changed files with 5 additions and 5 deletions

View File

@ -25,7 +25,7 @@ Flags:
### Server ### Server
``` ```
Example: Example:
./mini-chat server --port 1337 ./mini-chat server --port 1337 --history chat.log --password coolh4x0r1337
Usage: Usage:
mini-chat server [flags] mini-chat server [flags]
@ -35,5 +35,5 @@ Flags:
-r, --history string File to store and recover chat history from -r, --history string File to store and recover chat history from
--insecure [UNSAFE] Do not use TLS encryption --insecure [UNSAFE] Do not use TLS encryption
--password string Password for accessing the chat server --password string Password for accessing the chat server
-p, --port string port to use for listening (default "1302") -p, --port string Port to use for listening (default "1302")
``` ```

View File

@ -131,7 +131,7 @@ func listenMessages(g *gocui.Gui) {
} }
func receiveMessage(conn net.Conn) (s string, b int, err error) { func receiveMessage(conn net.Conn) (s string, b int, err error) {
serverMessage := make([]byte, 2048) serverMessage := make([]byte, 1536)
n, err := conn.Read(serverMessage) n, err := conn.Read(serverMessage)
if err != nil { if err != nil {
return "", 0, err return "", 0, err

View File

@ -16,7 +16,7 @@ var serverCmd = &cobra.Command{
using a proper interface this time, not using netcat. using a proper interface this time, not using netcat.
Example: Example:
./mini-chat server --port 1337`, ./mini-chat server --port 1337 --history chat.log --password coolh4x0r1337`,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
if err := setServerParameters(cmd); err != nil { if err := setServerParameters(cmd); err != nil {
@ -29,7 +29,7 @@ Example:
func init() { func init() {
rootCmd.AddCommand(serverCmd) rootCmd.AddCommand(serverCmd)
serverCmd.PersistentFlags().StringP("port", "p", "1302", "port to use for listening") serverCmd.PersistentFlags().StringP("port", "p", "1302", "Port to use for listening")
serverCmd.PersistentFlags().StringP("history", "r", "", "File to store and recover chat history from") serverCmd.PersistentFlags().StringP("history", "r", "", "File to store and recover chat history from")
serverCmd.PersistentFlags().String("password", "", "Password for accessing the chat server") serverCmd.PersistentFlags().String("password", "", "Password for accessing the chat server")
serverCmd.Flags().Bool("insecure", false, "[UNSAFE] Do not use TLS encryption") serverCmd.Flags().Bool("insecure", false, "[UNSAFE] Do not use TLS encryption")