KevaChat App for NPS Protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.8 KiB

7 months ago
# npsapp
7 months ago
7 months ago
KevaChat Server for [NPS Protocol](https://nightfall.city/nps/info/specification.txt)
7 months ago
Listen connections on `1915` port and save messages to given `namespace` in [KevaCoin](https://github.com/kevacoin-project) blockchain
7 months ago
7 months ago
![kevachat/npsapp](https://github.com/kevachat/npsapp/assets/108541346/936191f7-7ea7-44bd-bcd9-085f2a7f0a7b)
7 months ago
7 months ago
To read messages, use KevaChat [webapp](https://github.com/kevachat/webapp), [geminiapp](https://github.com/kevachat/geminiapp) or any [KevaCoin explorer](https://github.com/kvazar-network/awesome-kevacoin#explorers)!
7 months ago
7 months ago
## Components
7 months ago
* [kevachat/kevacoin-php](https://github.com/kevachat/kevacoin-php) - KevaCoin library for PHP 8
* [cboden/ratchet](https://github.com/ratchetphp/Ratchet) - Asynchronous Socket server
* [gregwar/captcha](https://github.com/Gregwar/Captcha) - Captcha library to prevent spam abuse
7 months ago
* [ixnode/php-cli-image](https://github.com/ixnode/php-cli-image) - Library converts captcha to ASCII format
7 months ago
## Install
* `git clone https://github.com/kevachat/npsapp.git`
* `cd npsapp`
* `composer update`
## Setup
* `cd npsapp`
* `cp config/example.json config/name.json` - edit connection and provide room namespace
## Launch
* `php src/app.php name.json` - where `name.json` argument is any config, placed at `config` folder
### Autostart
Launch server as the `systemd` service
You can create as many servers as wanted by providing separated config for each instance!
Following example require `npsapp` installed into the home directory of `npsapp` user (`useradd -m npsapp`)
1. `sudo nano /etc/systemd/system/npsapp.service` - create new service:
``` npsapp.service
[Unit]
After=network.target
[Service]
Type=simple
User=npsapp
Group=npsapp
ExecStart=/usr/bin/php /home/npsapp/npsapp/src/app.php name.json
StandardOutput=file:/home/npsapp/debug.log
StandardError=file:/home/npsapp/error.log
Restart=on-failure
[Install]
WantedBy=multi-user.target
```
2. `sudo systemctl daemon-reload` - reload systemd configuration
3. `sudo systemctl enable npsapp` - enable `npsapp` service on system startup
7 months ago
4. `sudo systemctl start npsapp` - start `npsapp` server
7 months ago
## Proxy
7 months ago
Like [NEX Protocol](https://nightfall.city/nex/info/specification.txt), NPS data could be simply forwarded using any proxy server that support TCP streams
7 months ago
### Nginx
7 months ago
```
# /etc/nginx/nginx.conf
7 months ago
stream {
server {
listen 1915;
proxy_pass 127.0.0.1:1915;
}
}
```
7 months ago
## Clients
7 months ago
7 months ago
* `nc 127.0.0.1 1915` - IPv4 only, install `netcat-openbsd` to add IPv6 support
* `ncat 127.0.0.1 1915`
7 months ago
* `telnet 127.0.0.1 1915`
7 months ago
## Servers
7 months ago
* Instance by [YGGverse](https://github.com/YGGverse)
7 months ago
* `[201:23b4:991a:634d:8359:4521:5576:15b7]:1915` - [Yggdrasil](https://github.com/yggdrasil-network) network
7 months ago
* `kevachat.ygg:1915` - [Alfis DNS](https://github.com/Revertron/Alfis) alias
* `kevachat.duckdns.org:1915` - Internet proxy (IPv4)