# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['rnsh']

package_data = \
{'': ['*']}

install_requires = \
['docopt>=0.6.2,<0.7.0', 'psutil>=5.9.4,<6.0.0', 'rns>=0.4.8,<0.5.0']

entry_points = \
{'console_scripts': ['rnsh = rnsh.rnsh:rnsh_cli']}

setup_kwargs = {
    'name': 'rnsh',
    'version': '0.0.3',
    'description': 'Shell over Reticulum',
    'long_description': '# `r n s h` \xa0Shell over Reticulum \n[![CI](https://github.com/acehoss/rnsh/actions/workflows/python-package.yml/badge.svg)](https://github.com/acehoss/rnsh/actions/workflows/python-package.yml)\xa0\n[![Release](https://github.com/acehoss/rnsh/actions/workflows/python-publish.yml/badge.svg)](https://github.com/acehoss/rnsh/actions/workflows/python-publish.yml)\xa0\n[![PyPI version](https://badge.fury.io/py/rnsh.svg)](https://badge.fury.io/py/rnsh)\n\n`rnsh` is a utility written in Python that facilitates shell \nsessions over [Reticulum](https://reticulum.network) networks. \nIt is based on the `rnx` utility that ships with Reticulum and\naims to have provide a similar experience to SSH.\n\n`rnsh` is still a little raw; there are some things that are \nimplemented badly, and many other things that haven\'t been \nbuilt at all (yet). Signals (i.e. Ctrl-C) need some work, so have\nanother terminal handy to send a SIGTERM if things glitch\nout.\n\nAnyway, there\'s a lot of room for improvement.\n\n## Quickstart\n\nTested (thus far) on Python 3.11 macOS 13.1 ARM64. Should\nrun on Python 3.6+ on Linux or Unix. WSL probably works. \nCygwin might work, too.\n\n- Activate a virtualenv\n- `pip3 install rnsh`\n  - Or from a `whl` release, `pip3 install /path/to/rnsh-0.0.1-py3-none-any.whl`\n- Configure Reticulum interfaces, check with `rnstatus`\n- Ready to run `rnsh`. The options are shown below.\n\n### Example: Shell server\n#### Setup\nBefore running the listener or initiator, you\'ll need to get the \nlistener destination hash and the initiator identity hash.\n```shell\n# On listener\nrnsh -l -p\n\n# On initiator\nrnsh -p\n```\nNote: if you are using a non-default identity or service name, be\nsure to supply these options with `-p` as the identity and \ndestination hashes will change depending on these settings.\n\n#### Listener\n- Listening for default service name ("default").\n- Using user\'s default Reticulum config dir (~/.reticulum).\n- Using default identity ($RNSCONFIGDIR/storage/identities/rnsh).\n- Allowing remote identity `6d47805065fa470852cf1b1ef417a1ac` to connect.\n- Launching `/bin/zsh` on authorized connect.\n```shell\nrnsh -l -a 6d47805065fa470852cf1b1ef417a1ac -- /bin/zsh\n```\n#### Initiator\n- Connecting to default service name ("default").\n- Using user\'s default Reticulum config dir (~/.reticulum).\n- Using default identity ($RNSCONFIGDIR/storage/identities/rnsh).\n- Connecting to destination `a5f72aefc2cb3cdba648f73f77c4e887`\n```shell\nrnsh a5f72aefc2cb3cdba648f73f77c4e887\n```\n\n## Options\n```\nUsage:\n    rnsh [--config <configdir>] [-i <identityfile>] [-s <service_name>] [-l] -p\n    rnsh -l [--config <configfile>] [-i <identityfile>] [-s <service_name>] \n         [-v... | -q...] [-b <period>] (-n | -a <identity_hash> [-a <identity_hash>] ...) \n         [--] <program> [<arg> ...]\n    rnsh [--config <configfile>] [-i <identityfile>] [-s <service_name>] \n         [-v... | -q...] [-N] [-m] [-w <timeout>] <destination_hash>\n    rnsh -h\n    rnsh --version\n\nOptions:\n    --config DIR             Alternate Reticulum config directory to use\n    -i FILE --identity FILE  Specific identity file to use\n    -s NAME --service NAME   Listen on/connect to specific service name if not default\n    -p --print-identity      Print identity information and exit\n    -l --listen              Listen (server) mode\n    -b --announce PERIOD     Announce on startup and every PERIOD seconds\n                             Specify 0 for PERIOD to announce on startup only.\n    -a HASH --allowed HASH   Specify identities allowed to connect\n    -n --no-auth             Disable authentication\n    -N --no-id               Disable identify on connect\n    -m --mirror              Client returns with code of remote process\n    -w TIME --timeout TIME   Specify client connect and request timeout in seconds\n    -v --verbose             Increase verbosity\n                                    DEFAULT LEVEL\n                                              CRITICAL\n                                Initiator ->  ERROR\n                                              WARNING\n                                 Listener ->  INFO\n                                              DEBUG\n    -q --quiet               Increase quietness\n    --version                Show version\n    -h --help                Show this help\n```\n\n## How it works\n### Listeners\nListener instances are the servers. Each listener is configured \nwith an RNS identity, and a service name. Together, RNS makes\nthese into a destination hash that can be used to connect to\nyour listener.\n   \nMultiple listeners can use the same identity. As long as \nthey are given different service names. They will have \ndifferent destination hashes and not conflict.\n\nListeners must be configured with a command line to run (at \nleast at this time). The identity hash string is set in the\nenvironment variable RNS_REMOTE_IDENTITY for use in child\nprograms.\n\nListeners are set up using the `-l` flag.\n   \n### Initiators\nInitiators are the clients. Each initiator has an identity\nhash which is used as an authentication mechanism on Reticulum.\nYou\'ll need this value to configure the listener to allow \nyour connection. It is possible to run the server without \nauthentication, but hopefully it\'s obvious that this is an\nadvanced use case. \n    \nTo get the identity hash, use the `-p` flag.\n    \nWith the initiator identity set up in the listener command\nline, and with the listener identity copied (you\'ll need to\ndo `-p` on the listener side, too), you can run the\ninitiator.\n    \nI recommend staying pretty vanilla to start with and\ntrying `/bin/zsh` or whatever your favorite shell is these \ndays. The shell should start in login mode. Ideally it\nworks just like an `ssh` shell session.\n\n### Protocol\nThe protocol is build on top of the Reticulum `Request` and\n`Packet` APIs.\n\n- After the initiator identifies on the connection, it enters\n  a request loop. \n- When idle, the initiator will periodically \n  poll the listener. \n- When the initiator has data available (i.e the user typed \n  some characters), the initiator will send that data to the\n  listener in a request, and the listener will respond with \n  any data available from the listener. \n- When the listener has new data available, it notifies the \n  initiator using a notification packet. The initiator then \n  makes a request to the listener to fetch the data.\n   \n## Roadmap\n1. Plan a better roadmap\n2. ?\n3. Keep my day job\n\n## TODO\n- [X] ~~Initial version~~\n- [X] ~~Pip package with command-line utility support~~\n- [X] ~~Publish to PyPI~~\n- [ ] Improve signal handling\n- [ ] Protocol improvements (throughput!)\n- [ ] Test on several *nixes\n- [ ] Make it scriptable (currently requires a tty)\n- [ ] Documentation improvements\n',
    'author': 'acehoss',
    'author_email': 'acehoss@acehoss.net',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'None',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.9,<4.0',
}


setup(**setup_kwargs)
