diff --git a/.gitignore b/.gitignore index 495b99b16..527b67fe3 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,6 @@ /genevd /genev /ircd -/ircd2 /darkirc /tau /taud diff --git a/README.md b/README.md index c5873c91f..f813cf184 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ a Dark Renaissance. ## Connect to DarkFi IRC -Follow the [installation instructions](https://darkrenaissance.github.io/darkfi/misc/ircd/ircd.html) +Follow the [installation instructions](https://darkrenaissance.github.io/darkfi/misc/darkirc/darkirc.html#installation) for the P2P IRC daemon. ## Build diff --git a/bin/darkirc/README.md b/bin/darkirc/README.md index f6e60cf8e..ee94f1520 100644 --- a/bin/darkirc/README.md +++ b/bin/darkirc/README.md @@ -1,11 +1,11 @@ -# ircd +# darkirc -see [Darkfi Book](https://darkrenaissance.github.io/darkfi/misc/ircd.html) for the installation guide. +see [Darkfi Book](https://darkrenaissance.github.io/darkfi/misc/darkirc/darkirc.html) for the installation guide. ## Services -To operate with ircd using IRC clients, we can implement special +To operate with `darkirc` using IRC clients, we can implement special namespaces which we are then able to query and use that as the client's interactive communication with the server/daemon: diff --git a/bin/darkirc/script/README.md b/bin/darkirc/script/README.md index 0198f972f..33c0d16cb 100644 --- a/bin/darkirc/script/README.md +++ b/bin/darkirc/script/README.md @@ -32,4 +32,4 @@ the tweet text and print it out in irc. ## `tau-notifier` sends notifications about some `tau` commands (namely: adding a new task, changing state, reassigning and new comments) to desired channels -in `ircd`. \ No newline at end of file +in `darkirc`. \ No newline at end of file diff --git a/bin/darkirc/script/tmux_session/tmux_sessions.sh b/bin/darkirc/script/tmux_session/tmux_sessions.sh index 4dd803054..6bfa4111a 100755 --- a/bin/darkirc/script/tmux_session/tmux_sessions.sh +++ b/bin/darkirc/script/tmux_session/tmux_sessions.sh @@ -1,30 +1,30 @@ #!/bin/sh -# Start a tmux session of four ircd nodes, and optionally four weechat clients. +# Start a tmux session of four darkirc nodes, and optionally four weechat clients. set -e tmux new-session -s "darkirc" -n "darkirc" -d tmux send-keys "../../../../darkirc --config seed.toml" Enter && sleep 1 tmux split-window -h -tmux send-keys "../../../../darkirc --config ircd_full_node1.toml" Enter && sleep 1 +tmux send-keys "../../../../darkirc --config darkirc_full_node1.toml" Enter && sleep 1 tmux split-window -h -tmux send-keys "../../../../darkirc --config ircd_full_node2.toml" Enter +tmux send-keys "../../../../darkirc --config darkirc_full_node2.toml" Enter tmux select-pane -t 0 tmux split-window -v -tmux send-keys "../../../../darkirc --config ircd_full_node3.toml" Enter +tmux send-keys "../../../../darkirc --config darkirc_full_node3.toml" Enter tmux select-pane -t 2 tmux split-window -v -tmux send-keys "../../../../darkirc --config ircd_full_node4.toml" Enter +tmux send-keys "../../../../darkirc --config darkirc_full_node4.toml" Enter if [ -z "$1" ]; then tmux new-window -t "darkirc:1" -n "weechat" - tmux send-keys "weechat -t -r '/server add ircd_a 127.0.0.1/22022 -notls;/connect ircd_a;/nick Alice'" Enter + tmux send-keys "weechat -t -r '/server add darkirc_a 127.0.0.1/22022 -notls;/connect darkirc_a;/nick Alice'" Enter tmux split-window -v - tmux send-keys "weechat -t -r '/server add ircd_b 127.0.0.1/22023 -notls;/connect ircd_b;/nick Bob'" Enter + tmux send-keys "weechat -t -r '/server add darkirc_b 127.0.0.1/22023 -notls;/connect darkirc_b;/nick Bob'" Enter tmux split-window -h - tmux send-keys "weechat -t -r '/server add ircd_c 127.0.0.1/22024 -notls;/connect ircd_c;/nick Charlie'" Enter + tmux send-keys "weechat -t -r '/server add darkirc_c 127.0.0.1/22024 -notls;/connect darkirc_c;/nick Charlie'" Enter tmux select-pane -t 0 tmux split-window -h - tmux send-keys "weechat -t -r '/server add ircd_d 127.0.0.1/22025 -notls;/connect ircd_d;/nick Dave'" Enter + tmux send-keys "weechat -t -r '/server add darkirc_d 127.0.0.1/22025 -notls;/connect darkirc_d;/nick Dave'" Enter fi tmux attach diff --git a/bin/darkirc/src/settings.rs b/bin/darkirc/src/settings.rs index 98908b1e8..d3aa11852 100644 --- a/bin/darkirc/src/settings.rs +++ b/bin/darkirc/src/settings.rs @@ -47,7 +47,7 @@ pub enum RPL { EndOfNames = 366, } -/// ircd cli +/// darkirc cli #[derive(Clone, Deserialize, StructOpt, StructOptToml)] #[serde(default)] #[structopt(name = "darkirc")] diff --git a/doc/src/SUMMARY.md b/doc/src/SUMMARY.md index 607e3eb21..606e94ea8 100644 --- a/doc/src/SUMMARY.md +++ b/doc/src/SUMMARY.md @@ -53,9 +53,9 @@ - [Reading maths books](crypto/reading-maths-books.md) - [Miscellaneous tools](misc/misc.md) - [vanityaddr](misc/vanityaddr.md) - - [darkirc](misc/ircd/ircd.md) - - [Specification](misc/ircd/specification.md) - - [Private Message](misc/ircd/private_message.md) + - [darkirc](misc/darkirc/darkirc.md) + - [Specification](misc/darkirc/specification.md) + - [Private Message](misc/darkirc/private_message.md) - [tau](misc/tau.md) - [event_graph](misc/event_graph/event_graph.md) - [Network Protocol](misc/event_graph/network_protocol.md) diff --git a/doc/src/development/contribute.md b/doc/src/development/contribute.md index 8a4778082..333a8d899 100644 --- a/doc/src/development/contribute.md +++ b/doc/src/development/contribute.md @@ -3,7 +3,7 @@ ## How to get started Every monday 16:00 CET, there is our main dev meeting on -[our chat](https://darkrenaissance.github.io/darkfi/misc/ircd/ircd.html). +[our chat](https://darkrenaissance.github.io/darkfi/misc/darkirc/darkirc.html). Feel free to join and discuss with other darkfi devs. In general, the best way to get started is to explore the codebase thoroughly and diff --git a/doc/src/development/learn.md b/doc/src/development/learn.md index 94224fee8..389fa75b0 100644 --- a/doc/src/development/learn.md +++ b/doc/src/development/learn.md @@ -173,7 +173,7 @@ and participating in crypto communities. 1. Download and install a simple Linux operating system to get started. Options can be Ubuntu or Manjaro Linux. 2. Watch [Finematics videos](https://www.youtube.com/c/Finematics/videos). 3. Begin the initial stage listed above. -4. Follow the instructions on the Darkfi Book and run [ircd](Book https://darkrenaissance.github.io/darkfi/misc/ircd/ircd.html) to connect with the team. +4. Follow the instructions on the Darkfi Book and run [darkirc](Book https://darkrenaissance.github.io/darkfi/misc/darkirc/darkirc.html) to connect with the team. ## Further Reading diff --git a/doc/src/misc/darkirc.md b/doc/src/misc/darkirc.md new file mode 100644 index 000000000..504569952 --- /dev/null +++ b/doc/src/misc/darkirc.md @@ -0,0 +1 @@ +# darkirc diff --git a/doc/src/misc/ircd/ircd.md b/doc/src/misc/darkirc/darkirc.md similarity index 69% rename from doc/src/misc/ircd/ircd.md rename to doc/src/misc/darkirc/darkirc.md index ad49996a8..2a17f49bc 100644 --- a/doc/src/misc/ircd/ircd.md +++ b/doc/src/misc/darkirc/darkirc.md @@ -1,10 +1,10 @@ # DarkIRC: Strong Anonymity P2P Chat In DarkFi, we organize our communication using resilient and -censorship-resistant infrastructure. For chatting, `ircd` is a +censorship-resistant infrastructure. For chatting, `darkirc` is a peer-to-peer implementation of an IRC server in which any user can participate anonymously using any IRC frontend and by running the -IRC daemon. `ircd` uses the DarkFi P2P engine to synchronize chats +IRC daemon. `darkirc` uses the DarkFi P2P engine to synchronize chats between hosts. ## Benefits @@ -28,37 +28,50 @@ you have all the necessary dependencies. ```shell % git clone https://github.com/darkrenaissance/darkfi -% cd darkfi && git checkout v0.4.1 -% make BINS=ircd -% sudo make install BINS=ircd +% cd darkfi +% make darkirc +% # install system wide only if you can make sure there would be no +% # multiple darkirc versions installed +% sudo make install darkirc ``` ## Usage (DarkFi Network) -Upon installing `ircd` as described above, the preconfigured defaults +Upon installing `darkirc` as described above, the preconfigured defaults will allow you to connect to the network and start chatting with the rest of the DarkFi community. -First, try to start `ircd` from your command-line so it can spawn its +First, try to start `darkirc` from your command-line so it can spawn its configuration file in place. The preconfigured defaults will autojoin -you to the `#dev` channel, where the community is most active and -talks about DarkFi development. +you to several default channels one of which is `#dev` where we have +weekly meetings, and where the community is most active and talks +about DarkFi development. ```shell -% ircd +% darkirc ``` -After running it for the first time, `ircd` will create a configuration -file you can review and potentially edit. It might be useful if you -want to add other channels you want to autojoin (like `#philosophy` -and `#memes`), or if you want to set a shared secret for some channel -in order for it to be encrypted between its participants. +`darkirc` will create a configuration file `darkirc_config.toml` by +default in `~/.config/darkfi/` you can review and potentially edit. It +might be useful if you want to add other channels you want to autojoin +(like `#philosophy` and `#memes`), or if you want to set a shared +secret for some channel in order for it to be encrypted between its +participants. -When done, you can run `ircd` for the second time in order for it to +When done, you can run `darkirc` for the second time in order for it to connect to the network and start participating in the P2P protocol: ```shell -% ircd +% darkirc +``` + +Whenever you edit `darkirc_config.toml` file and if you have your +`darkirc` daemon running you don't need to restart it to reload the +config, you just need to send a SIGHUP signal to it for the changes to +reflect, one of the easiest ways to do that is: + +```shell +% kill -SIGHUP $(pidof darkirc) ``` ## Clients @@ -67,7 +80,7 @@ connect to the network and start participating in the P2P protocol: In this section, we'll briefly cover how to use the [Weechat IRC client](https://github.com/weechat/weechat) to connect and chat with -`ircd`. +`darkirc`. Normally, you should be able to install weechat using your distribution's package manager. If not, have a look at the weechat @@ -75,9 +88,9 @@ distribution's package manager. If not, have a look at the weechat on how to install it on your computer. Once installed, we can configure a new server which will represent our -`ircd` instance. First, start weechat, and in its window - run the +`darkirc` instance. First, start weechat, and in its window - run the following commands (there is an assumption that `irc_listen` in the -`ircd` config file is set to `127.0.0.1:6667`): +`darkirc` config file is set to `127.0.0.1:6667`): ``` /server add darkfi localhost/6667 -notls -autoconnect @@ -85,17 +98,33 @@ following commands (there is an assumption that `irc_listen` in the /quit ``` +Note: if you have other IRC servers added in your client +then you probably know this but you can ommit `-autoconnect` part. + This will set up the server, save the settings, and exit weechat. You are now ready to begin using the chat. Simply start weechat and everything should work. When you join, you will not see any users displayed. This is normal -since there is no concept of nicknames or registration on this +since there is no concept of nicknames or registration on this p2p anonymous chat. You can change your nickname using `/nick foo`, and navigate channels using F5/F6 or ALT+X where X is the channel number displayed. +## Network-level privacy + +Nodes have knowledge of their peers, including the IP addresses of +connected hosts. + +DarkFi supports the use of pluggable transports, including Tor and Nym, +to provide network-level privacy. As long as there are live seed nodes +configured to support a Tor or Nym connection, users can connect to +`darkirc` and benefit from the protections offered by these protocols. + +Other approaches include connecting via a cloud server or VPN. Research +the risks involved in these methods before connecting. + ## Usage (Local Deployment) These steps below are only for developers who wish to make a testing @@ -177,7 +206,7 @@ servers: /set irc.look.temporary_servers on -Finally you can attach to the local IRCd instances: +Finally you can attach to the local darkirc instances: /connect localhost/6667 /connect localhost/6668 @@ -192,16 +221,7 @@ inbound and outbound connections. ## Global Buffer -Copy [this script](https://github.com/narodnik/weechat-global-buffer/blob/main/buffclone.py) to `~/.weechat/python/autoload/`, -and you will create a single buffer which aggregates messages from all channels. It's useful to monitor activity -from all channels without needing to flick through them. - -## Network-level privacy - -Nodes have knowledge of their peers, including the IP addresses of connected hosts. - -DarkFi supports the use of pluggable transports, including Tor and Nym, to provide network-level privacy. As long as there -are live seed nodes configured to support a Tor or Nym connection, users can connect to `ircd` and benefit from the -protections offered by these protocols. - -Other approaches include connecting via a cloud server or VPN. Research the risks involved in these methods before connecting. +Copy [this script](https://github.com/narodnik/weechat-global-buffer/blob/main/buffclone.py) +to `~/.weechat/python/autoload/`, and you will create a single buffer +which aggregates messages from all channels. It's useful to monitor +activity from all channels without needing to flick through them. diff --git a/doc/src/misc/darkirc/private_message.md b/doc/src/misc/darkirc/private_message.md new file mode 100644 index 000000000..3f439fdcd --- /dev/null +++ b/doc/src/misc/darkirc/private_message.md @@ -0,0 +1,93 @@ + +# Configuring a Private chat between users + +Any two users on the `darkirc` server can establish a fully encrypted +communication medium between each other using a basic keypair setup. + +## Configuring darkirc_config.toml + +`darkirc_config.toml` should be created by default in `~/.config/darkfi/` +when you first run `darkirc`. + +Generate a keypair using the following command: + +```shell +% darkirc --gen-keypair +``` +This will generate a Public Key and a Private Key. + +Save the Private key safely & add it to the `darkirc_config.toml` file as shown below. + +```toml +[private_key.”your_private_key_goes_here”] +``` + +To share your Public Key with a user over `darkirc` you can use one of the +public channels or via an external app like Signal, as plaintext DMs +are disabled in `darkirc`. + +Note: If you use the `darkirc`'s public channel, your +message will be publically visible on the IRC chat. + +See the [example darkirc_config.toml](https://github.com/darkrenaissance/darkfi/blob/master/bin/darkirc/darkirc_config.toml) for more details + +## Example +Lets start by configuring our contacts list in the generated +`darkirc_config.toml` file (you can also refer to the examples written +in the comments of the toml file), let's assume alice and bob want to +privately chat after they have each other's public keys: + +Alice would add bob to her contact list in her own config file: +```toml +[contact.”bob”] +public_key = “D6UzKA6qCG5Mep16i6pJYkUCQcnp46E1jPBsUhyJiXhb” +``` + +And Bob would do the same: +```toml +[contact.”alice”] +public_key = “9sfMEVLphJ4dTX3SEvm6NBhTbWDqfsxu7R2bo88CtV8g” + +``` + + +Lets see an Example where 'alice' sends “Hi” message to 'bob' using +the /msg command + + /msg bob Hi + + +Note for Weechat Client Users:\ +When you private message someone as shown above, the buffer will not +pop in weechat client until you receive a reply from that person. + +For example here 'alice' will not see any new buffer on her irc interface for +the recent message which she just send to 'bob' until 'bob' replies, +but 'bob' will get a buffer shown on his irc client with the message 'Hi'. + +Reply from 'bob' to 'alice' + + /msg alice welcome! + + +Or instead of `/msg` command, you can use: +``` +/query bob hello +``` +This works exactly the same as `/msg` except it will open a new buffer +with Bob in your client regardless. + +Again, you can edit or update the contact list in `darkirc_config.toml` +while the deamon is still running, and request it to reload the updated +config with just sending it a SIGHUP. + +Note: The contact name is not the irc nickname, it can +be anything you want, and you should use it when DMing. + +Note: It's always a good idea to save your keys somewhere safe, but in +case you lost your Public Key and you still have your Private key in +`darkirc_config.toml` file, you recover the Public Key like so: +```shell +% darkirc --recover-pubkey {your_private_key} +``` + diff --git a/doc/src/misc/ircd/specification.md b/doc/src/misc/darkirc/specification.md similarity index 98% rename from doc/src/misc/ircd/specification.md rename to doc/src/misc/darkirc/specification.md index d3864e142..b7797f74d 100644 --- a/doc/src/misc/ircd/specification.md +++ b/doc/src/misc/darkirc/specification.md @@ -1,9 +1,9 @@ -# Ircd Specification +# DarkIRC Specification ## PrivMsgEvent -This is the main message type inside Ircd. The `PrivMsgEvent` is an +This is the main message type inside `darkirc`. The `PrivMsgEvent` is an [event action](https://darkrenaissance.github.io/darkfi/misc/event_graph/network_protocol.html#event). diff --git a/doc/src/misc/ircd.md b/doc/src/misc/ircd.md deleted file mode 100644 index d907aaf79..000000000 --- a/doc/src/misc/ircd.md +++ /dev/null @@ -1 +0,0 @@ -# ircd diff --git a/doc/src/misc/ircd/private_message.md b/doc/src/misc/ircd/private_message.md deleted file mode 100644 index 98759fcc4..000000000 --- a/doc/src/misc/ircd/private_message.md +++ /dev/null @@ -1,106 +0,0 @@ - -# Configuring a Private chat between users - -Any two users on the `ircd` server can establish a fully encrypted -communication medium between each other using a basic keypair setup. - -## Configuring ircd_config.toml - -`ircd_config.toml` should be created by default in `~/.config/darkfi/` -when you first run `ircd`. - -Generate a keypair using the following command: - -```shell -% ircd --gen-keypair -``` -This will generate a Public Key and a Private Key. - -Save the Private key safely & add it to the `ircd_config.toml` file as shown below. - -```toml -[private_key.”your_private_key_goes_here”] -``` - -To share your Public Key with a user over `ircd` you can use one of the -public channels or via an external app like Signal, as plaintext DMs -are disabled in `ircd`. - -Note: If you use the first method your message will be publically -visible on the IRC chat. - -See the [example ircd_config.toml](https://github.com/darkrenaissance/darkfi/blob/master/bin/ircd/ircd_config.toml) for more details - -It's always a good practice to save your keys somewhere safe, but in -case you lost your Public Key and you still have your Private key in -`ircd_config.toml` file, you recover the Public Key like so: -```shell -% ircd --recover-pubkey {your_private_key} -``` - -## Example -Lets start by configuring our contacts list in the generated `ircd_config.toml` file -(you can also refer to the examples written in the comments of the toml file) - -```toml -[contact.”User_A”] -contact_pubkey = “XXXXXXX” -[contact.”User_B”] -contact_pubkey = “YYYYYYY” -``` - -Note: After configuring our `ircd_config.toml` file, you -will need to restart your irc demon for the changes to reflect. - - -Lets see an Example where 'User_A' sends “Hi” message to 'User_B' using -the /msg command - - /msg User_B Hi - -IRCD logs of 'User_A' -``` -9:36:59 [INFO] [CLIENT 127.0.0.1:xxxx] Msg: PRIVMSG User_B :Hi -09:36:59 [INFO] [CLIENT 127.0.0.1:xxxx] (Plain) PRIVMSG User_B :Hi -09:36:59 [INFO] [CLIENT 127.0.0.1:57964] (Encrypted) PRIVMSG: Privmsg { id: 12345, nickname: “xxxxxxx”, target: “xxxxx”, message: “xxxxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 } -09:36:59 [INFO] [P2P] Broadcast: Privmsg { id: 7563042059426128593, nickname: “xxxx”, target: “xxxxx”, message: “xxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 } -``` -IRCD logs of 'User_B' -``` -09:36:59 [INFO] [P2P] Received: Privmsg { id: 123457, nickname: “xxxx”, target: “xxxx”, message: “xxxx”, timestamp: 1665481019, term: 0, read_confirms: 0 } -09:36:59 [INFO] [P2P] Decrypted received message: Privmsg { id: 123457, nickname: "User_A", target: "User_B", message: "Hi", timestamp: 1665481019, term: 0, read_confirms: 0 } -``` -Note for Weechat Client Users:\ -When you private message someone as shown above, the buffer will not -pop in weechat client until you receive a reply from that person. - -For example here 'User_A' will not see any new buffer on his irc interface for -the recent message which he just send to 'User_B' until 'User_B' replies, -but 'User_B' will get a buffer shown on his irc client with the message 'Hi'. - -Reply from 'User_B' to 'User_A' - - /msg User_A welcome! - -IRCD logs of 'User_B' -``` -10:25:45 [INFO] [CLIENT 127.0.0.1:57396] Msg: PRIVMSG User_A :welcome! -10:25:45 [INFO] [CLIENT 127.0.0.1:57396] (Plain) PRIVMSG User_A :welcome! -10:25:45 [INFO] [CLIENT 127.0.0.1:57396] (Encrypted) PRIVMSG: Privmsg { id: 123458, nickname: “xxxx”, target: “xxxx”, message: “yyyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 } -10:25:45 [INFO] [P2P] Broadcast: Privmsg { id: 123458, nickname: “xxxxx”, target: “xxxxx”, message: “yyyyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 } -``` -IRCD logs of 'User_A' -``` -10:25:46 [INFO] [P2P] Received: Privmsg { id: 123458, nickname: “xxxxxxx”, target: “xxxxxx”, message: “yyyyyy”, timestamp: 1665483945, term: 0, read_confirms: 0 } -10:25:46 [INFO] [P2P] Decrypted received message: Privmsg { id: 123458, nickname: "User_B”, target: "User_A”, message: "welcome! ", timestamp: 1665483945, term: 0, read_confirms: 0 } -``` - -Or instead of `/msg` command, you can use: -``` -/query User_B hello -``` -This works exactly the same as `/msg` except it will open a new buffer -with the User_B in your client regardless. - -Note: The contact name is not the irc nickname, it can -be anything you want, and you should use it when DMing.