aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorJeff Halter <868228+jhalter@users.noreply.github.com>2021-07-24 17:54:17 -0700
committerJeff Halter <868228+jhalter@users.noreply.github.com>2021-07-24 17:54:17 -0700
commit6988a0571d5d37ea0f38ee3e4066533158f608bc (patch)
tree172010de54ea7e732d7daa836db659021dc8a933 /client
Initial squashed commit
Diffstat (limited to 'client')
-rw-r--r--client/banners/1.txt6
-rw-r--r--client/banners/2.txt9
-rw-r--r--client/banners/3.txt6
-rw-r--r--client/banners/4.txt7
-rw-r--r--client/banners/5.txt11
-rw-r--r--client/banners/6.txt12
-rw-r--r--client/banners/7.txt7
-rw-r--r--client/banners/8.txt10
-rw-r--r--client/banners/9.txt9
-rw-r--r--client/main.go103
-rw-r--r--client/mobius-client-config.yaml7
11 files changed, 187 insertions, 0 deletions
diff --git a/client/banners/1.txt b/client/banners/1.txt
new file mode 100644
index 0000000..608a316
--- /dev/null
+++ b/client/banners/1.txt
@@ -0,0 +1,6 @@
+ __ __ ______ ______ __ __ __ __ ______
+/\ \_\ \ /\ __ \ /\__ _\ /\ \ /\ \ /\ "-.\ \ /\ ___\
+\ \ __ \ \ \ \/\ \ \/_/\ \/ \ \ \____ \ \ \ \ \ \-. \ \ \ __\
+ \ \_\ \_\ \ \_____\ \ \_\ \ \_____\ \ \_\ \ \_\\"\_\ \ \_____\
+ \/_/\/_/ \/_____/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_____/
+ \ No newline at end of file
diff --git a/client/banners/2.txt b/client/banners/2.txt
new file mode 100644
index 0000000..1121e06
--- /dev/null
+++ b/client/banners/2.txt
@@ -0,0 +1,9 @@
+ ▄█ █▄ ▄██████▄ ███ ▄█ ▄█ ███▄▄▄▄ ▄████████
+ ███ ███ ███ ███ ▀█████████▄ ███ ███ ███▀▀▀██▄ ███ ███
+ ███ ███ ███ ███ ▀███▀▀██ ███ ███▌ ███ ███ ███ █▀
+ ▄███▄▄▄▄███▄▄ ███ ███ ███ ▀ ███ ███▌ ███ ███ ▄███▄▄▄
+▀▀███▀▀▀▀███▀ ███ ███ ███ ███ ███▌ ███ ███ ▀▀███▀▀▀
+ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ █▄
+ ███ ███ ███ ███ ███ ███▌ ▄ ███ ███ ███ ███ ███
+ ███ █▀ ▀██████▀ ▄████▀ █████▄▄██ █▀ ▀█ █▀ ██████████
+ ▀ \ No newline at end of file
diff --git a/client/banners/3.txt b/client/banners/3.txt
new file mode 100644
index 0000000..608a316
--- /dev/null
+++ b/client/banners/3.txt
@@ -0,0 +1,6 @@
+ __ __ ______ ______ __ __ __ __ ______
+/\ \_\ \ /\ __ \ /\__ _\ /\ \ /\ \ /\ "-.\ \ /\ ___\
+\ \ __ \ \ \ \/\ \ \/_/\ \/ \ \ \____ \ \ \ \ \ \-. \ \ \ __\
+ \ \_\ \_\ \ \_____\ \ \_\ \ \_____\ \ \_\ \ \_\\"\_\ \ \_____\
+ \/_/\/_/ \/_____/ \/_/ \/_____/ \/_/ \/_/ \/_/ \/_____/
+ \ No newline at end of file
diff --git a/client/banners/4.txt b/client/banners/4.txt
new file mode 100644
index 0000000..3b9d720
--- /dev/null
+++ b/client/banners/4.txt
@@ -0,0 +1,7 @@
+.___.__  ._______  _____._.___    .___ .______  ._______
+:   |  \ : .___  \ \__ _:||   |   : __|:      \ : .____/
+|   :   || :   |  |  |  :||   |   | : ||       || : _/\ 
+|   .   ||     :  |  |   ||   |/\ |   ||   |   ||   /  \
+|___|   | \_. ___/   |   ||   /  \|   ||___|   ||_.: __/
+    |___|   :/       |___||______/|___|    |___|   :/   
+    :                                       
diff --git a/client/banners/5.txt b/client/banners/5.txt
new file mode 100644
index 0000000..1d468d5
--- /dev/null
+++ b/client/banners/5.txt
@@ -0,0 +1,11 @@
+ ,ggg, gg
+dP""Y8b 88 I8 ,dPYb,
+Yb, `88 88 I8 IP'`Yb
+ `" 88 88 88888888 I8 8I gg
+ 88aaaaaaa88 I8 I8 8' ""
+ 88"""""""88 ,ggggg, I8 I8 dP gg ,ggg,,ggg, ,ggg,
+ 88 88 dP" "Y8ggg I8 I8dP 88 ,8" "8P" "8, i8" "8i
+ 88 88 i8' ,8I ,I8, I8P 88 I8 8I 8I I8, ,8I
+ 88 Y8,,d8, ,d8' ,d88b, ,d8b,_ _,88,_,dP 8I Yb, `YbadP'
+ 88 `Y8P"Y8888P" 88P""Y888P'"Y888P""Y88P' 8I `Y8888P"Y888
+
diff --git a/client/banners/6.txt b/client/banners/6.txt
new file mode 100644
index 0000000..3098da2
--- /dev/null
+++ b/client/banners/6.txt
@@ -0,0 +1,12 @@
+
+@@@ @@@ @@@@@@ @@@@@@@ @@@ @@@ @@@ @@@ @@@@@@@@
+@@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ @@@@ @@@ @@@@@@@@
+@@! @@@ @@! @@@ @@! @@! @@! @@!@!@@@ @@!
+!@! @!@ !@! @!@ !@! !@! !@! !@!!@!@! !@!
+@!@!@!@! @!@ !@! @!! @!! !!@ @!@ !!@! @!!!:!
+!!!@!!!! !@! !!! !!! !!! !!! !@! !!! !!!!!:
+!!: !!! !!: !!! !!: !!: !!: !!: !!! !!:
+:!: !:! :!: !:! :!: :!: :!: :!: !:! :!:
+:: ::: ::::: :: :: :: :::: :: :: :: :: ::::
+ : : : : : : : : :: : : : :: : : :: ::
+
diff --git a/client/banners/7.txt b/client/banners/7.txt
new file mode 100644
index 0000000..c072e25
--- /dev/null
+++ b/client/banners/7.txt
@@ -0,0 +1,7 @@
+██╗ ██╗ ██████╗ ████████╗██╗ ██╗███╗ ██╗███████╗
+██║ ██║██╔═══██╗╚══██╔══╝██║ ██║████╗ ██║██╔════╝
+███████║██║ ██║ ██║ ██║ ██║██╔██╗ ██║█████╗
+██╔══██║██║ ██║ ██║ ██║ ██║██║╚██╗██║██╔══╝
+██║ ██║╚██████╔╝ ██║ ███████╗██║██║ ╚████║███████╗
+╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝
+
diff --git a/client/banners/8.txt b/client/banners/8.txt
new file mode 100644
index 0000000..d75e153
--- /dev/null
+++ b/client/banners/8.txt
@@ -0,0 +1,10 @@
+ ██░ ██ ▒█████ ▄▄▄█████▓ ██▓ ██▓ ███▄ █ ▓█████
+▓██░ ██▒▒██▒ ██▒▓ ██▒ ▓▒▓██▒ ▓██▒ ██ ▀█ █ ▓█ ▀
+▒██▀▀██░▒██░ ██▒▒ ▓██░ ▒░▒██░ ▒██▒▓██ ▀█ ██▒▒███
+░▓█ ░██ ▒██ ██░░ ▓██▓ ░ ▒██░ ░██░▓██▒ ▐▌██▒▒▓█ ▄
+░▓█▒░██▓░ ████▓▒░ ▒██▒ ░ ░██████▒░██░▒██░ ▓██░░▒████▒
+ ▒ ░░▒░▒░ ▒░▒░▒░ ▒ ░░ ░ ▒░▓ ░░▓ ░ ▒░ ▒ ▒ ░░ ▒░ ░
+ ▒ ░▒░ ░ ░ ▒ ▒░ ░ ░ ░ ▒ ░ ▒ ░░ ░░ ░ ▒░ ░ ░ ░
+ ░ ░░ ░░ ░ ░ ▒ ░ ░ ░ ▒ ░ ░ ░ ░ ░
+ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ ░
+
diff --git a/client/banners/9.txt b/client/banners/9.txt
new file mode 100644
index 0000000..eba9134
--- /dev/null
+++ b/client/banners/9.txt
@@ -0,0 +1,9 @@
+ █████ █████ █████ ████ ███
+░░███ ░░███ ░░███ ░░███ ░░░
+ ░███ ░███ ██████ ███████ ░███ ████ ████████ ██████
+ ░███████████ ███░░███░░░███░ ░███ ░░███ ░░███░░███ ███░░███
+ ░███░░░░░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███████
+ ░███ ░███ ░███ ░███ ░███ ███ ░███ ░███ ░███ ░███ ░███░░░
+ █████ █████░░██████ ░░█████ █████ █████ ████ █████░░██████
+░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░ ░░░░░ ░░░░░░
+
diff --git a/client/main.go b/client/main.go
new file mode 100644
index 0000000..a761404
--- /dev/null
+++ b/client/main.go
@@ -0,0 +1,103 @@
+package main
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ hotline "github.com/jhalter/mobius"
+ "github.com/rivo/tview"
+ "go.uber.org/zap"
+ "go.uber.org/zap/zapcore"
+ "os"
+ "os/signal"
+ "syscall"
+ "time"
+)
+
+//var defaultTrackerList = []string{
+// "hltracker.com:5498",
+//}
+
+const connectTimeout = 3 * time.Second
+
+func main() {
+ _, cancelRoot := context.WithCancel(context.Background())
+
+ sigChan := make(chan os.Signal, 1)
+ signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT, os.Interrupt)
+
+ version := flag.Bool("version", false, "print version and exit")
+ logLevel := flag.String("log-level", "info", "Log level")
+ userName := flag.String("name", "unnamed", "User name")
+ //srvAddr := flag.String("server", "localhost:5500", "Hostname/Port of server")
+ //login := flag.String("login", "guest", "Login Name")
+ //pass := flag.String("password", "", "Login Password")
+ flag.Parse()
+
+ if *version {
+ fmt.Printf("v%s\n", hotline.VERSION)
+ os.Exit(0)
+ }
+
+ zapLvl, ok := zapLogLevel[*logLevel]
+ if !ok {
+ fmt.Printf("Invalid log level %s. Must be debug, info, warn, or error.\n", *logLevel)
+ os.Exit(0)
+ }
+
+ // init DebugBuffer
+ db := &hotline.DebugBuffer{
+ TextView: tview.NewTextView(),
+ }
+
+ cores := []zapcore.Core{
+ newDebugCore(zapLvl, db),
+ //newStderrCore(zapLvl),
+ }
+ l := zap.New(zapcore.NewTee(cores...))
+ defer func() { _ = l.Sync() }()
+ logger := l.Sugar()
+ logger.Infow("Started Mobius client", "Version", hotline.VERSION)
+
+ go func() {
+ sig := <-sigChan
+ logger.Infow("Stopping client", "signal", sig.String())
+ cancelRoot()
+ }()
+
+ client := hotline.NewClient(*userName, logger)
+ client.DebugBuf = db
+ client.UI.Start()
+
+}
+
+func newDebugCore(level zapcore.Level, db *hotline.DebugBuffer) zapcore.Core {
+ encoderCfg := zap.NewProductionEncoderConfig()
+ encoderCfg.TimeKey = "timestamp"
+ encoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder
+
+ return zapcore.NewCore(
+ zapcore.NewConsoleEncoder(encoderCfg),
+ zapcore.Lock(db),
+ level,
+ )
+}
+
+func newStderrCore(level zapcore.Level) zapcore.Core {
+ encoderCfg := zap.NewProductionEncoderConfig()
+ encoderCfg.TimeKey = "timestamp"
+ encoderCfg.EncodeTime = zapcore.ISO8601TimeEncoder
+
+ return zapcore.NewCore(
+ zapcore.NewConsoleEncoder(encoderCfg),
+ zapcore.Lock(os.Stderr),
+ level,
+ )
+}
+
+var zapLogLevel = map[string]zapcore.Level{
+ "debug": zap.DebugLevel,
+ "info": zap.InfoLevel,
+ "warn": zap.WarnLevel,
+ "error": zap.ErrorLevel,
+}
diff --git a/client/mobius-client-config.yaml b/client/mobius-client-config.yaml
new file mode 100644
index 0000000..c46d269
--- /dev/null
+++ b/client/mobius-client-config.yaml
@@ -0,0 +1,7 @@
+Username: unnamed
+IconID: 2000
+Bookmarks:
+ - Name: Example Server
+ Addr: localhost:5500
+ Login: guest
+ Password: ""