github.com/ericwq/aprilsh@v0.0.0-20240517091432-958bc568daa0/README.md (about) 1 Aprilsh: remote shell support intermittent or mobile network. inspired by [mosh](https://mosh.org/) and [zutty](https://github.com/tomscii/zutty). aprilsh is a remote shell based on UDP, authenticate user via openssh. 2 3 ## Installation 4 5 ### Reqirement 6 - [open-ssh](https://www.openssh.com/) is a must reqirement, openssh is needed to perform user authentication. 7 - [locale support](https://git.adelielinux.org/adelie/musl-locales/-/wikis/home) is a must reqirement. 8 - [ncurses and terminfo](https://invisible-island.net/ncurses/) is a must requirement. 9 - [systmd](https://systemd.io/) reuired for redhat linux family (fedora, centos, redhat). 10 - [utmps](https://skarnet.org/software/utmps/) reuired only for alpine 11 - [openrc](https://github.com/OpenRC/openrc) required only for alpine. 12 - [logrotate](https://github.com/logrotate/logrotate) reuired only for alpine. 13 14 if you perfer to build aprilsh manually, please refer to [this document](doc/install-alpine.md) 15 16 ### Alpine linux 17 Before start apshd, you need to make sure you can ssh login to the target server, please refer to [this doc](doc/ssh-alpine.md) to setup a ssh enabled docker container. 18 19 Note: aprilsh is still waiting for aports approval. For now please use the following private repository. The private repository only provide `x86_64` packages. Refer to [build doc](doc/build.md) to know how to build apk packages and private repositories. 20 ```sh 21 wget -P /etc/apk/keys/ https://ericwq.github.io/alpine/packager-663ebf9b.rsa.pub # add public key 22 echo "https://ericwq.github.io/alpine/v3.19/testing" >> /etc/apk/repositories # add private repository 23 apk update # update repositories metadata 24 apk add aprilsh # install client and server 25 ``` 26 Now you can ssh login to the server and the aprilsh is installed, it's time to start apshd server and login with apsh. 27 ```sh 28 rc-service apshd start # start apshd server 29 apsh -m 100 eric@localhost:8022 # apsh login to server 30 ``` 31 Note: when aports finally approve aprilsh, the above private repository will be replaced by official testing repositories. The testing repositories will provide all architecture packages. 32 ```sh 33 echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories # add testing repositories 34 ``` 35 36 ### Fedora, CentOS, Redhat linux 37 Note: This is a private yum/dnf repositories, it only provides `x86_64` packages. Refer to [rpms doc](https://codeberg.org/ericwq/rpms#build-rpm-packages) to understand how to build rpm packags and dnf repositories. 38 ```sh 39 rpm --import https://ericwq.codeberg.page/RPM-GPG-KEY-wangqi # import public key to rpm DB 40 dnf config-manager --add-repo https://ericwq.codeberg.page/aprilsh.repo # add new repo to dnf repository 41 dnf install aprilsh # install client and server 42 ``` 43 Before start apshd, you need to make sure you can ssh login to the target server, please refer to [this doc](doc/ssh-fedora.md) to setup a ssh enabled docker container. 44 45 Now you can ssh login to the server, it's time to start apshd service and login with apsh. 46 ```sh 47 sudo systemctl start apshd.service #start apshd service 48 sudo journalctl -f -u apshd.service #keep reading the latest apshd.service log 49 apsh user@host # start apsh client on different host 50 ``` 51 ### MacOS 52 ```sh 53 brew tap ericwq/utils # add tap to homebrew 54 brew install aprilsh # only install aprilsh client 55 ``` 56 Refer to [homebrew doc](https://github.com/ericwq/homebrew-utils) to know how to create homebrew package and tap. 57 ### Validate installation 58 by default apshd listen on udp localhost:8100. 59 ```txt 60 openrc-nvide:~# netstat -lup 61 Active Internet connections (only servers) 62 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name 63 udp 0 0 localhost:8100 0.0.0.0:* 45561/apshd 64 openrc-nvide:~# 65 ``` 66 now login to the system with apsh (aprilsh client), note the `motd`(welcome message) depends on you alpine system config. 67 ```txt 68 qiwang@Qi15Pro client % apsh ide@localhost 69 openrc-nvide:0.10.2 70 71 Lua, C/C++ and Golang Integrated Development Environment. 72 Powered by neovim, luals, gopls and clangd. 73 ide@openrc-nvide:~ $ 74 ``` 75 if you login on two terminals, on the server, there will be two server processes serve the clients. the following shows `apshd` serve two clients. one is`:8101`, the other is ':8102' 76 ```sh 77 openrc:~# netstat -lp 78 Active Internet connections (only servers) 79 Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name 80 tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN 225/sshd [listener] 81 tcp 0 0 :::ssh :::* LISTEN 225/sshd [listener] 82 udp 0 0 localhost:8100 0.0.0.0:* 45561/apshd 83 udp 0 0 :::8101 :::* 45647/apshd 84 udp 0 0 :::8102 :::* 45612/apshd 85 Active UNIX domain sockets (only servers) 86 Proto RefCnt Flags Type State I-Node PID/Program name Path 87 unix 2 [ ACC ] STREAM LISTENING 872486 159/s6-ipcserverd /run/utmps/.btmpd-socket 88 unix 2 [ ACC ] STREAM LISTENING 869747 253/s6-ipcserverd /run/utmps/.utmpd-socket 89 unix 2 [ ACC ] STREAM LISTENING 866239 281/s6-ipcserverd /run/utmps/.wtmpd-socket 90 openrc-nvide:~# 91 ``` 92 ## Motivation 93 94 [openSSH](https://www.openssh.com/) is excellent. While `mosh` provides better keystroke prediction/latency and is capable of handle WiFi/cellular mobile network roaming. But `mosh` project is not active anymore and no release [sine 2017](https://github.com/mobile-shell/mosh/issues/1115). Such a good project like `mosh` should keeps developing. 95 96 After read through `mosh` source code, I decide to rewrite it with golang. Go is my first choice because the C++ syntax is too complex. Go also has excellent support for UTF-8 and multithreaded programming. The last reason: go compiler is faster than c++ compiler. 97 98 There are several rules for this project: 99 100 - Keep the base design of `mosh`: `SSP`, UDP, keystroke prediction. 101 - Use 3rd party library as less as possible to keep it clean. 102 103 There are also some goals for this project: 104 105 - Full UTF-8 support, including [emoji and flag](https://unicode.org/emoji/charts/emoji-list.html) support. 106 - Support the terminal 24bit color. 107 - Upgrade to [proto3](https://developers.google.com/protocol-buffers/docs/proto3) 108 - Use terminfo database for better compatibility. 109 - Prove golang is a good choice for terminal developing. 110 111 The project name `Aprilsh` is derived from `April+sh`. This project started in shanghai April 2022, and it's a remote shell. Use the above command to add musl locales support and utmps support for alpine. Note alpine only support UTF-8 charmap. 112 113 ## Architecture 114 115 ![aprilsh.svg](img/aprilsh.svg) 116 117 - The green part is provided by the system/terminal emulator. Such as [alacritty](https://alacritty.org/) or [kitty](https://sw.kovidgoyal.net/kitty/). 118 - The cyan part is provided by `Aprilsh`. 119 - The yellow part is our target terminal application. In the above diagram it's `neovim`. 120 - Actually the yellow part can be any terminal based application: [emcas](https://www.gnu.org/software/emacs/), [neovim](https://neovim.io/), [htop](https://htop.dev/), etc. 121 - The rest part is provided by the system. 122 123 ## Changelog 124 125 Ready for early acess. The missing part is prediction engine tuning. Check [here](doc/changelog.md) for history deatil. 126 127 ## License 128 129 [MIT](LICENSE)