Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b93aff00d9 | |||
| 8d65145c2c |
@@ -1,12 +1,30 @@
|
|||||||
all: client server
|
server_clean:
|
||||||
|
rm server
|
||||||
|
|
||||||
re: clean client server
|
client_clean:
|
||||||
|
rm client
|
||||||
|
|
||||||
clean:
|
clean: server_clean client_clean
|
||||||
rm client.o server.o
|
|
||||||
|
|
||||||
client:
|
|
||||||
go build -o client.o client.go
|
|
||||||
|
|
||||||
server:
|
server:
|
||||||
go build -o server.o server.go
|
go build server.go
|
||||||
|
|
||||||
|
client:
|
||||||
|
go build client.go
|
||||||
|
|
||||||
|
build: server client
|
||||||
|
|
||||||
|
ins_server:
|
||||||
|
go build -o ekho_server server.go
|
||||||
|
mv ekho_server /usr/local/bin/
|
||||||
|
cp ekho.service /etc/systemd/system/ekho.service
|
||||||
|
mkdir -p ~/.config/ekho
|
||||||
|
ln -s -r ./list.q ~/.config/ekho/list.q
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable ekho
|
||||||
|
systemctl start ekho
|
||||||
|
systemctl status ekho
|
||||||
|
|
||||||
|
ins_client:
|
||||||
|
go build -o ekho client.go
|
||||||
|
mv ekho /usr/local/bin/
|
||||||
|
|||||||
@@ -3,80 +3,84 @@
|
|||||||
## Why?
|
## Why?
|
||||||
To test my abilities to develop networked programs, and to enhance my skills in writing such.
|
To test my abilities to develop networked programs, and to enhance my skills in writing such.
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
### Hardware
|
### Hardware
|
||||||
- Client machine
|
- Client machine
|
||||||
- Server machine (not required to be distinct from Client)
|
- Server machine (not required to be distinct from Client)
|
||||||
|
|
||||||
### Software
|
### Software
|
||||||
- [Golang]
|
- Tested with [golang] v1.26
|
||||||
- Linux distro (highly recommened)
|
- Installation has only been tested with [just] v1.53
|
||||||
- ```make``` is also used in this guide, but the makefile is incredibly simple, and can be skipped entirely by running ```go build``` instead
|
- Server installation assumes systemd (tested with v260.2)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
Golang can be installed on Mac with
|
|
||||||
``` sh
|
|
||||||
brew install golang
|
|
||||||
```
|
|
||||||
Clone the repo
|
Clone the repo
|
||||||
``` sh
|
``` sh
|
||||||
git clone https://github.com/alexander-the-alright/ekho
|
git clone https://github.com/alexander-the-alright/ekho
|
||||||
cd ekho
|
cd ekho
|
||||||
```
|
```
|
||||||
Using your favorite text editor, change the destination IP and Port to whatever works for you. This is defined on line 247 in client.go as 127.0.0.1:1300.
|
|
||||||
|
|
||||||
Now the server file needs to be run on the preferred port, as specified in the client file. This is defined on line 257 in server.go.
|
#### Justfile
|
||||||
|
It is recommended to use ```just``` for installation, as it has more
|
||||||
|
capabilities than ```make```, however, there is a makefile included.
|
||||||
|
To install the server with ```just```, run ```sudo just ins_server```.
|
||||||
|
You will be prompted to enter a new port number to run the server on (
|
||||||
|
or leave blank to use 1300). The port will be changed in the source
|
||||||
|
file before compilation.
|
||||||
|
To install the client with ```just```, run ```sudo just ins_client```.
|
||||||
|
You will be prompted to enter the IP (or URL) and port of the server
|
||||||
|
(or leave blank to use localhost:1300). The IP/URL and port will be
|
||||||
|
changed in the source file before compilation.
|
||||||
|
|
||||||
|
#### Makefile
|
||||||
|
If you are unable or willing to use ```just```, the included makefile
|
||||||
|
still has most of the functionality, but it does not change any
|
||||||
|
important parameters. The following changes are advised before
|
||||||
|
installation.
|
||||||
|
|
||||||
The binary(s) can be obtained using the makefile
|
1. On the client machine, change the IP/URL and port in the client source file. This can be
|
||||||
If the server is being run on a separate machine, only run make with client flag
|
done quickly with ```sed -i -e "s/127.0.0.1:1300/YOUR.IP.GOES.HERE:PORT/" client.go```
|
||||||
``` sh
|
2. On the server machine, change the port in the server source file. This can be done with a
|
||||||
make client
|
similar command: ```sed -i -e "s/1300/PORT/" server.go```. (note: this
|
||||||
```
|
should match the port from bullet 1)
|
||||||
If both binaries are being run on the same machine, ```make all``` will suffice. Although, both of these commands can be bypassed with ```go build```, as this is all ```make``` does anyway.
|
3. On the server machine, change the user referenced in the systemd service file. This can be
|
||||||
``` sh
|
done with another sed command, ```sed -e -i "s/USER/YOUR_USERNAME/" ekho.service```
|
||||||
make all
|
|
||||||
```
|
|
||||||
|
|
||||||
#### NOTE
|
After making these changes on the respective machines, run either
|
||||||
In previous versions, the suggested method of installation involved placing bash scripts in ```/etc/update-motd.d/```, however, there have been issues getting that installation method working (namely, having MOTD run user-defined commands), and the current quick and extremely dirty suggested installation method is to just append the user's shell config files (```.bashrc```, ```.bash_profile```, ```.zshrc```, etc) with the paths to the executables.
|
```sudo make ins_client``` or ```sudo make ins_server``` to compile and install the client
|
||||||
|
and/or server binaries.
|
||||||
|
|
||||||
For example, if the server used zsh, the installation could look something like this:
|
#### After Installation
|
||||||
``` sh
|
After installation of the server binary, systemd will display the
|
||||||
echo "~/abs/path/to/server.o &" >> ~/.zshrc
|
status of the new service. It should be ```enabled``` and
|
||||||
```
|
```running```.
|
||||||
Similarly for a client using Bash:
|
|
||||||
``` sh
|
|
||||||
echo "~/abs/path/to/client.o" >> ~/.bashrc
|
|
||||||
```
|
|
||||||
|
|
||||||
Any help figuring out the issue with MOTD would be appreciated.
|
|
||||||
|
|
||||||
Finally done!
|
Finally done!
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
The client uses the following flags
|
The client uses the following flags
|
||||||
``` sh
|
``` sh
|
||||||
-h - display help message
|
-h - display help message
|
||||||
-a <s> - adds required argument <s> as a quote to server
|
-a <string> - adds required argument <s> as a quote to server
|
||||||
|
-ip <ip:port> - specify alternate server destination
|
||||||
-l - list all quotes
|
-l - list all quotes
|
||||||
-r [i] - remove; may be run with or without argument
|
-r [i] - remove; may be run with or without argument
|
||||||
-ip - specify alternate server destination
|
-s <i> - specify the size of the receipt buffer
|
||||||
-s - specify the size of the receipt buffer
|
|
||||||
```
|
```
|
||||||
The server uses the following flags
|
The server uses the following flags
|
||||||
``` sh
|
``` sh
|
||||||
-h - display help message
|
-h - display help message
|
||||||
-s - specify the size of the receipt buffer
|
-s <i> - specify the size of the receipt buffer
|
||||||
|
-v - display version and exit
|
||||||
|
-vv - display version and about info and exit
|
||||||
```
|
```
|
||||||
|
|
||||||
### How It Works
|
|
||||||
The sequence diagram can be viewed in ```diag``` folder, which shows the sequence of networked messages for each usage of ekho.
|
|
||||||
The source code is in the same folder, ```ekho-seq.txt```, and can be uploaded to [sequencediagram.org][seqdiag] to rerender the diagram and view any updates.
|
|
||||||
|
|
||||||
|
|
||||||
### To Be Implemented
|
### To Be Implemented
|
||||||
- Log all uses/transaction data each day
|
- Log all uses/transaction data each day
|
||||||
- Request, send, and receive the logfile for any day
|
- Request, send, and receive the logfile
|
||||||
- User-specific quotes/quotefiles
|
- User-specific quotes/quotefiles
|
||||||
- Installation (client-side, at least) via MOTD
|
- Colored printing and coloring quotes
|
||||||
|
- Edit quotes
|
||||||
|
|
||||||
[golang]: <https://go.dev/doc/install>
|
[golang]: <https://go.dev/doc/install>
|
||||||
[seqdiag]: <sequencediagram.org>
|
[just]: <https://github.com/casey/just>
|
||||||
|
|||||||
@@ -339,7 +339,7 @@ func main() {
|
|||||||
flag.BoolVar( &add, "a", false, "add quote to list" )
|
flag.BoolVar( &add, "a", false, "add quote to list" )
|
||||||
flag.BoolVar( &remove, "r", false, "remove quote from list" )
|
flag.BoolVar( &remove, "r", false, "remove quote from list" )
|
||||||
flag.BoolVar( &list, "l", false, "print quote list" )
|
flag.BoolVar( &list, "l", false, "print quote list" )
|
||||||
flag.StringVar( &dest, "ip", ":1300", "ip:port of server" )
|
flag.StringVar( &dest, "ip", "127.0.0.1:1300", "ip:port of server" )
|
||||||
flag.IntVar( &tsize, "s", 256, "transmission size ( bytes )" )
|
flag.IntVar( &tsize, "s", 256, "transmission size ( bytes )" )
|
||||||
flag.Parse() // process flags
|
flag.Parse() // process flags
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Ekho MOTD Server
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
User=USER
|
||||||
|
ExecStart=/usr/local/bin/ekho_server
|
||||||
|
WorkingDirectory=/home/USER/.config/ekho
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
# delete server bin
|
||||||
|
[private]
|
||||||
|
server_clean:
|
||||||
|
rm server
|
||||||
|
|
||||||
|
# delete client bin
|
||||||
|
[private]
|
||||||
|
client_clean:
|
||||||
|
rm client
|
||||||
|
|
||||||
|
# delete binaries
|
||||||
|
clean: server_clean client_clean
|
||||||
|
|
||||||
|
# build server bin
|
||||||
|
server:
|
||||||
|
go build server.go
|
||||||
|
|
||||||
|
# build client bin
|
||||||
|
client:
|
||||||
|
go build client.go
|
||||||
|
|
||||||
|
# build both bins
|
||||||
|
build: client server
|
||||||
|
|
||||||
|
# delete binaries and make them again
|
||||||
|
rebuild: clean build
|
||||||
|
|
||||||
|
# install server
|
||||||
|
ins_server:
|
||||||
|
#!/usr/bin/bash
|
||||||
|
echo "enter port of server or leave blank to use default (1300)"
|
||||||
|
read PORT
|
||||||
|
if [[ $PORT -ne "" ]]; then
|
||||||
|
sed -i -e "s/1300/$PORT/" server.go
|
||||||
|
fi
|
||||||
|
echo "go build -o ekho_server server.go"
|
||||||
|
go build -o ekho_server server.go
|
||||||
|
echo "mv ekho_server /usr/local/bin/"
|
||||||
|
mv ekho_server /usr/local/bin/
|
||||||
|
USER=($(users))
|
||||||
|
sed -i -e "s/USER/${USER[0]}/" ekho.service
|
||||||
|
echo "cp ekho.service /etc/systemd/system/"
|
||||||
|
cp ekho.service /etc/systemd/system/
|
||||||
|
mkdir -p ~/.config/ekho
|
||||||
|
echo "ln -s -r ./list.q ~/.config/ekho/list.q"
|
||||||
|
ln -s -r ./list.q ~/.config/ekho/list.q
|
||||||
|
echo "systemctl daemon-reload"
|
||||||
|
systemctl daemon-reload
|
||||||
|
echo "systemctl enable ekho"
|
||||||
|
systemctl enable ekho
|
||||||
|
echo "systemctl start ekho"
|
||||||
|
systemctl start ekho
|
||||||
|
echo "systemctl status ekho"
|
||||||
|
systemctl status ekho
|
||||||
|
|
||||||
|
|
||||||
|
# install client
|
||||||
|
ins_client:
|
||||||
|
#!/usr/bin/bash
|
||||||
|
echo "enter url or ip and port of server, 'aaa.bbb.ccc.ddd:port"
|
||||||
|
read IP_PORT
|
||||||
|
sed -i -e "s/:1300/$IP_PORT/" client.go
|
||||||
|
echo "go build -o ekho client.go"
|
||||||
|
go build -o ekho client.go
|
||||||
|
sed -i -e "s/$IP_PORT/:1300/" client.go
|
||||||
|
echo "mv ekho /usr/local/bin/"
|
||||||
|
mv ekho /usr/local/bin/
|
||||||
|
echo "add 'ekho' to shell config (config.fish, .bashrc, etc)"
|
||||||
|
|
||||||
@@ -1 +1,9 @@
|
|||||||
|
@user:
|
||||||
|
shmuley
|
||||||
|
floglin
|
||||||
|
@all:
|
||||||
|
blingo
|
||||||
|
no but like actually blingo shmingo
|
||||||
|
i would prefer not to
|
||||||
|
@default:
|
||||||
thank you for using ekho
|
thank you for using ekho
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
// Auth: alex
|
// Auth: alex
|
||||||
// File: server.go
|
// File: server.go
|
||||||
// Revn: 01-09-2025 5.0
|
// Revn: 05-12-2026 2.1.2
|
||||||
// Func: host MOTD connection
|
// Func: host MOTD connection
|
||||||
//
|
//
|
||||||
// TODO: remove ioutil import
|
// TODO:
|
||||||
// add more /codes/ to handle
|
// add user-specific prints
|
||||||
// add flags, like specify port
|
|
||||||
// write usage and errors to logfile
|
// write usage and errors to logfile
|
||||||
|
// remove ioutil import
|
||||||
// send logfile to client on request
|
// send logfile to client on request
|
||||||
|
// add color printing to qfile
|
||||||
|
// add flags?
|
||||||
|
// add more /codes/ to handle
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// CHANGE LOG
|
// CHANGE LOG
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -31,7 +34,7 @@
|
|||||||
// fixed bug in /r2/ where removing quote at final
|
// fixed bug in /r2/ where removing quote at final
|
||||||
// position would break
|
// position would break
|
||||||
// removed deadcode from /r2/, unused "quit" bool?
|
// removed deadcode from /r2/, unused "quit" bool?
|
||||||
//*10-17-2023: fixed bug where quotes are read from and saved to two
|
//#10-17-2023: fixed bug where quotes are read from and saved to two
|
||||||
// different files
|
// different files
|
||||||
// removed implicit newline at end of qfile to stop ghost
|
// removed implicit newline at end of qfile to stop ghost
|
||||||
// line bug in /la/
|
// line bug in /la/
|
||||||
@@ -43,7 +46,11 @@
|
|||||||
// commented
|
// commented
|
||||||
//*06-14-2024: byte count-based PWFT rewrite
|
//*06-14-2024: byte count-based PWFT rewrite
|
||||||
//*06-17-2024: catch keyboard interrupts with os/signal and syscall
|
//*06-17-2024: catch keyboard interrupts with os/signal and syscall
|
||||||
//*01-09-2025: copied lr/la PWFT updates into r1/r2
|
//#01-09-2025: copied lr/la PWFT updates into r1/r2
|
||||||
|
//*04-28-2026: removed implicit newline at end of qfile to stop ghost
|
||||||
|
// line bug in /la/ AGAIN
|
||||||
|
// 05-11-2026: updated fread() to handle users in qfile
|
||||||
|
// 05-12-2026: added v and vv input flags
|
||||||
//
|
//
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
@@ -114,10 +121,15 @@ func fread() string {
|
|||||||
// bugs where a blank item was introduced into qlist and calling
|
// bugs where a blank item was introduced into qlist and calling
|
||||||
// /la/ would produce a blank line on the client side that didn't
|
// /la/ would produce a blank line on the client side that didn't
|
||||||
// really exist
|
// really exist
|
||||||
//qfile = qfile[:len( qfile ) - 1]
|
qfile = qfile[:len( qfile ) - 1]
|
||||||
// cast bytes to string, split string over newline into array
|
// cast bytes to string, split string over newline into array
|
||||||
qlist = strings.Split( string( qfile ), "\n" )
|
//qlist = strings.Split( string( qfile ), "\n" )
|
||||||
// deal with the trailing
|
profiles := strings.Split( string( qfile ), "@" )
|
||||||
|
for _, p := range profiles {
|
||||||
|
quotes := strings.Split( p, ":" )
|
||||||
|
qlist[quotes[0]] = strings.Split( quotes[1], "\n" )
|
||||||
|
}
|
||||||
|
|
||||||
return string( qfile ) // return file as string
|
return string( qfile ) // return file as string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +155,17 @@ func handle( conn net.Conn ) {
|
|||||||
n, err := conn.Read( buffer[:] )
|
n, err := conn.Read( buffer[:] )
|
||||||
checkN( err, conn ) // make sure read worked
|
checkN( err, conn ) // make sure read worked
|
||||||
|
|
||||||
|
// message anatomy
|
||||||
|
// command@number[@user]
|
||||||
|
// @ @ delimiter
|
||||||
|
// command command, like list request or quote request
|
||||||
|
// number sequence or quote number
|
||||||
|
// user quote username if applicable, default if not give
|
||||||
|
// add request message anatomy
|
||||||
|
// command@quote[@user]
|
||||||
|
// quote quote to be added
|
||||||
|
// user quote username, default if not given
|
||||||
|
|
||||||
// cast message to string, take first n bytes, split over @
|
// cast message to string, take first n bytes, split over @
|
||||||
command := strings.Split( string( buffer[:n] ), "@" )
|
command := strings.Split( string( buffer[:n] ), "@" )
|
||||||
|
|
||||||
@@ -156,9 +179,20 @@ func handle( conn net.Conn ) {
|
|||||||
// concat and send
|
// concat and send
|
||||||
resp = "sa@" + num // size answer
|
resp = "sa@" + num // size answer
|
||||||
case "qr": // /qr/, quote request
|
case "qr": // /qr/, quote request
|
||||||
|
// see if user was sent
|
||||||
|
subcommands := strings.Split( command[1], ":" )
|
||||||
|
|
||||||
|
// keep track of name, or default if need be
|
||||||
|
var name string
|
||||||
|
if len( subcommands ) == 1 {
|
||||||
|
name = "default"
|
||||||
|
} else {
|
||||||
|
name = subcommands[1]
|
||||||
|
}
|
||||||
|
|
||||||
// convert message argument to string to make sure it's a
|
// convert message argument to string to make sure it's a
|
||||||
// valid number
|
// valid number
|
||||||
num, nerr := strconv.Atoi( command[1] )
|
num, nerr := strconv.Atoi( subcommands[0] )
|
||||||
// nerr will not be nil if comm[1] is not a number
|
// nerr will not be nil if comm[1] is not a number
|
||||||
if nerr != nil {
|
if nerr != nil {
|
||||||
// formulate an error message
|
// formulate an error message
|
||||||
@@ -166,7 +200,7 @@ func handle( conn net.Conn ) {
|
|||||||
resp = "ba@qr@!" // bad answer
|
resp = "ba@qr@!" // bad answer
|
||||||
} else { // comm[1] was a number, but...
|
} else { // comm[1] was a number, but...
|
||||||
switch { // how do we know it's a valid number
|
switch { // how do we know it's a valid number
|
||||||
case num > len( qlist ):
|
case num > len( qlist[name] ):
|
||||||
// bad answer in quote request
|
// bad answer in quote request
|
||||||
resp = "ba@qr@>"
|
resp = "ba@qr@>"
|
||||||
// why bad? num is >
|
// why bad? num is >
|
||||||
@@ -176,7 +210,7 @@ func handle( conn net.Conn ) {
|
|||||||
// why bad? num is -
|
// why bad? num is -
|
||||||
default:
|
default:
|
||||||
// good num, get quote, send off
|
// good num, get quote, send off
|
||||||
resp = "qa@" + qlist[num] // quote answer
|
resp = "qa@" + qlist[name][num] // quote answer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "lr": // /lr/, list request
|
case "lr": // /lr/, list request
|
||||||
@@ -218,7 +252,7 @@ func handle( conn net.Conn ) {
|
|||||||
}
|
}
|
||||||
case "ar": // /ar/, add request
|
case "ar": // /ar/, add request
|
||||||
// append new quote to list
|
// append new quote to list
|
||||||
qlist = append( qlist, command[1] )
|
qlist["f"] = append( qlist["f"], command[1] )
|
||||||
// also append new quote to file variable
|
// also append new quote to file variable
|
||||||
qfile = qfile + "\n" + command[1]
|
qfile = qfile + "\n" + command[1]
|
||||||
writeFile( qfile )
|
writeFile( qfile )
|
||||||
@@ -285,14 +319,14 @@ func handle( conn net.Conn ) {
|
|||||||
default:
|
default:
|
||||||
// replace the quote at that position with
|
// replace the quote at that position with
|
||||||
// final quote
|
// final quote
|
||||||
qlist[num] = qlist[len( qlist ) - 1]
|
qlist["f"][num] = qlist["f"][len( qlist ) - 1]
|
||||||
// remove second copy of quote
|
// remove second copy of quote
|
||||||
qlist = qlist[:len( qlist ) - 1]
|
qlist["f"] = qlist["f"][:len( qlist ) - 1]
|
||||||
// O(1) remove from list at any position
|
// O(1) remove from list at any position
|
||||||
// must entirely recreate quote string
|
// must entirely recreate quote string
|
||||||
var f string = "" // init empty string
|
var f string = "" // init empty string
|
||||||
// iterate over list, disregard index
|
// iterate over list, disregard index
|
||||||
for _, v := range qlist {
|
for _, v := range qlist["f"] {
|
||||||
// add next quote to file and separate
|
// add next quote to file and separate
|
||||||
// quotes with newline
|
// quotes with newline
|
||||||
f = f + v + "\n"
|
f = f + v + "\n"
|
||||||
@@ -332,10 +366,11 @@ func handle( conn net.Conn ) {
|
|||||||
|
|
||||||
|
|
||||||
// globals
|
// globals
|
||||||
var qlist []string // list of quotes
|
//var qlist []string // list of quotes
|
||||||
|
var qlist = make( map[string][]string )
|
||||||
var qfile string // file object
|
var qfile string // file object
|
||||||
var tsize int // size of transmission buffer
|
var tsize int // size of transmission buffer
|
||||||
|
var VERS string // version
|
||||||
|
|
||||||
// main, create port and wait for connection
|
// main, create port and wait for connection
|
||||||
func main() {
|
func main() {
|
||||||
@@ -345,12 +380,32 @@ func main() {
|
|||||||
// set interrupt and terminate signals to notify channel
|
// set interrupt and terminate signals to notify channel
|
||||||
signal.Notify( sigs, syscall.SIGINT, syscall.SIGTERM )
|
signal.Notify( sigs, syscall.SIGINT, syscall.SIGTERM )
|
||||||
|
|
||||||
|
// flag vars
|
||||||
|
var v bool // simple version
|
||||||
|
var vv bool // verbose version
|
||||||
|
|
||||||
// flag for default transmission size
|
// flag for default transmission size
|
||||||
flag.IntVar( &tsize, "s", 256, "transmission size ( bytes )" )
|
flag.IntVar( &tsize, "s", 256, "transmission size ( bytes )" )
|
||||||
|
flag.BoolVar( &v, "v", false, "display version and exit" )
|
||||||
|
flag.BoolVar( &vv, "vv", false, "display version and about info and exit" )
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
qfile = fread() // read quote file, init ( global ) list of quotes
|
// FIXME get better versioning method
|
||||||
|
VERS = "2.1.2"
|
||||||
|
|
||||||
|
if vv { // display info and exit
|
||||||
|
fmt.Println( "ekho server v" + VERS )
|
||||||
|
fmt.Println( "ekho is named after Echo the Oread" )
|
||||||
|
fmt.Println( "in Greek mythology, Echo was cursed by Hera to only be able to say the last words spoken to her" )
|
||||||
|
fmt.Println( "i found this to be quite fitting for a MOTD server" )
|
||||||
|
return
|
||||||
|
} else if v { // display info and exit
|
||||||
|
fmt.Println( VERS )
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qfile = fread() // read quote file, init ( global ) list of quotes
|
||||||
service := ":1300" // create service on ip and port
|
service := ":1300" // create service on ip and port
|
||||||
|
|
||||||
// resolve ip address and port
|
// resolve ip address and port
|
||||||
|
|||||||
Reference in New Issue
Block a user