Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/bayvictor/logconfchat

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/bayvictor/logconfchat

  • v0.0.0-20201008090542-d7760b2f64b2
  • Source
  • Go
  • Socket score

Version published
Created
Source

LogConfChat -- golang chat server, with a GUI-emulating, console UI , with both config-file & command line boost(host/port# etc), chat is loggable!

A chat server in golang, which log all activities for convenience for later analytics, and with config file boost. LogConfChat architecture: -- A chatserver wich log allactivities for convenience for later analytics, and config file support in golang.

1. Architecture
├── cmd_chat_client.go # Chat with vibriant GUI-like text consule UI
├── cmd_chat_server_7777.log # log for exec "cmd_chat_server" when running on port# 7777
├── cmd_chat_server.go #
├── config # persistence config like port#, when absent or error, using cmd os.Args[] default.
├── live_test.sh # minute-to-minute tweak script, test out all features.
├── pkg # when to "go get xxxx" external libraries put.
├── run_me_once.sh # init scripts, before any scripts run.
├── src #
├── test.results.log.txt # worksheets for development
└── write_config_file.go # which reveals how config structs
Where

2 open source golang libraries gocui, gonfig are used.

how to use:

step 1. git clone https://github.com/bayvictor/LogConfChat.git

Step 2. cd LogConfChat; source ./run_me_once.sh ## WARNING: if you missed this step, everything goes wrong!

step 3. run "source ./live_test.sh", inside which, setup GOPATH, running servers, clients.

step 3.2. servers.

  ## you can run multiple chatserver but on different port number.

./cmd_chat_server 2345 ## REPLACE 2345 with the actual port#, matching up-running server port you mean to ./cmd_chat_server 2346 ... ./cmd_chat_server ##which default to "5000" server init order: check confile file first, then os.Args[], if all missing or fail using default "5000" port.

Step 3.3. running client:

 connecting to right hostname, port#, with flexible initialization.

./cmd_chat_client localhost 2346 ##REPLACE 2345 with the actual port#, matching up-running server port you mean to connect ./cmd_chat_client some_where_over_the_rainbow 3456 ./cmd_chat_client remote_host 5678 ./cmd_chat_client ##which default to "localhost" "5000" The above server as it's name pointing out, can log all activities, can read/write config file using gonfig.

Licenses. like all its dependency here, this code and it's future change here, also totally free, but provided as it is and deny all liabilities.

================================================================================

Test Results, snapshots:

One of the client "victor" view, during "daniel" and "lambda" come and go!

┌─ messages: ───────────────────────────────────────────────┌─ 2 users: ───────┐
│[10:49:48] + daniel connected │victor │
│[10:49:55] daniel: i am the saint │victor │
│[10:50:02] daniel: daniel the one │ │
│[10:50:09] daniel: young winner. │ │
│[11:09:53] + victor connected │ │
│[11:09:54] victor: skdfjska │ │
│[11:09:55] victor: sdfksalk; │ │
│[11:09:57] victor: 12342143 │ │
│[11:09:59] victor: 34555566 │ │
│[11:10:00] victor: 445 │ │
│[11:10:02] victor: hello │ │
│[11:10:31] + lambda connected │ │
│[11:10:35] lambda: kaka │ │
│[11:10:37] lambda: yaya │ │
│[11:10:40] lambda: never! │ │
│[11:10:45] - lambda disconnected │ │
│[11:17:32] - daniel disconnected │ │
│ │ │
┌─ send: ───────────────────────────────────────────────────┐ │
│ │ │
│ │ │
│ │ │
└───────────────────────────────────────────────────────────┘──────────────────┘

Sample server log of above events:

cat victor.log

  • victor connected 2020/09/13 10:48:08 + victor connected victor: ye,ye, n\ya, yum,yum 2020/09/13 10:48:22 victor: ye,ye, n\ya, yum,yum victor: hello 2020/09/13 10:48:24 victor: hello
  • daniel connected 2020/09/13 10:49:48 + daniel connected ...
  • daniel disconnected 2020/09/13 11:17:32 - daniel disconnected

/================================================================== Client interface: full command line usage is "cmd_chat_client ", with argv[1],default is "cmd_chat_client localhost 5555".

=================================================================== Case: when multiple server starts in localhost, they log differently. filename: "os.Args[0]+"_"+os.Args[1]+".log", basically server-exec name+ portnumber which it running on.

=================================================================== manually check config file in "config/config.development.json", (because ENV default is development). change port to one never used before "5678", then go to batch test file run2.sh, change all command line port to "5678", find it read out and use ok. If remove "config/" dir then run, all fails because without configfile, server port default to 5000 without argument. found it behave correctly.

FAQs

Package last updated on 08 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc