1. 2

    Seems like a new p2p messaging app pops up every year. I wish you luck but I can’t see it even passing tox which is fairly unusable.

    1. 25

      Agreed, but it’s fun to work on.

      1. 23

        THIS is the mentality I admire. Every time I come up with a new project and want to show it off, I’m inundated with “yeah, but X already exists! Why would you make another one?” Because it’s fun! Because I want my own! Because I want to write code!

        Keep it up, it’s a cool project.

        1. 12

          Thank you! Having my own project like this to refactor and perfect allows me to stay sane in the business-focused “it ain’t broke” environment of the real world.

        2. 8

          I love this mentality and that’s why I wrote my own p2p chat app too.

          The most fun part was learning how to punch through firewalls, building messaging on top of UDP, and encryption.

          Learning is best done through doing.

          Question , what encryption does your chat app use?

          1. 3

            None whatsoever 🙊. All messages are transmitted in the clear right now, to obvious peril. Another goal I’d like to hit is implementing end-to-end encryption I’m interested in using libsignal, but don’t know enough about it to know if it’s applicable in a p2p protocol like this.

            1. 2

              I’d like to see yours too if you want to share.

              1. 1

                I haven’t worked on it in like a year, though recently started doing some C++17 revamp. It’s called Fire★. It’s interesting that you chose GTK, any reason to pick that over something like Qt?

                1. 1

                  None other than that the Rust bindings looked mature and are easy enough to work with. I actually started by wrapping it with Swift and making an iOS app. I made some progress but it was pretty hard to maintain the Swift wrapper, wrapping a C interface, wrapping the actual library.

                  Fire(star) looks pretty cool. Next time I have some free time with my laptop I want to play around with it.

                  1. 2

                    Interesting, hopefully the Rust people will get decent Qt bindings. Qt is pretty damn great. If you ever do play with Firestr, PM me your ID and I’ll send you mine.

          2. 3

            what’s wrong with tox?

            1. 3

              Nothing that I know of.

              1. 2

                Last I saw which was a little while ago, It didn’t work well at all on mobile because you need a constant connection to the network which drains your battery and data real fast. Matrix looks a lot more promising for real use.

                1. 1

                  does matrix have video chat?

                  1. 1

                    It does. It has almost all the features of things like discord and slack but they need to be polished more and sped up.

                2. 1

                  Doesn’t Tox have occasional developer drama every so often?

                3. 1

                  Can you clarify what Tox is and, more importantly, why you think it wouldn’t pass?

                  I think you mean “be better than Tox [another messaging system], which has its own usability problems”.

                  1. 2

                    Tox is another P2P messaging system. The Qt client is a little wonky, and I remember having issues when trying to do group chat. Beyond that, it was really nice to use, and the voice chat functionality was surprisingly great. The last time I used Tox was maybe 2014 so maybe it’s changed since then. I think the main thing Tox has going for it ahead of other P2P systems is that it’s relatively popular and well-known.

                1. 5

                  Though the PROTOCOL.md is fairly light on details, it sounds a lot like S/Kademlia (PDF), is this by design or just a coincidence?

                  Basically it’s the same idea that BitTorrent uses for the Mainline DHT (Kademlia), but with a “Secure” addition which uses IDs that are generated from a public key of the node rather than randomly.

                  1. 3

                    Very much by design. Then chat layer is built on top of a networking layer that is basically a DHT of nodes. I based this part of the project on the design of the Mainline DHT outlined in BEP 5.

                    The network layer is self-bootstrapping, and self-healing. It provides a minimal interface to send a “packet” to any address in the network. It only guarantees that it will deliver that packet as closely to the intended recipient as it can. All the relaying, message acknowledging, etc lives in the chat layer on top of that.

                    Glad you could recognize the design. Thanks for looking!

                    1. 2

                      Very cool. I’m enjoying reading through the code. Good work. :)

                      1. 1

                        Hope you update PROTOCOL.md once it stabilizes, would be fun to write a compatible client in another language. Chat apps are fun.

                        1. 1

                          Definitely. I’d like to get a JS version of this out there, using websockets instead of UDP, so that nodes can run in the browser.

                          1. 3

                            Do you mean WebRTC?

                            That’s kinda the challenge that IPFS has (which also uses an S/Kademlia variant). They have WebRTC nodes in their JS implementation, and normal TCP nodes for the Go implementation, and bridging the two is tricky as there’s basically no full implementation of WebRTC aside from the C++ one.

                            One fun tangent if you’re into it (something I looked into a few years ago): The IPFS DHT is actually fairly liberal with the kinds of nodes it’ll interface with and messages it’ll pass around. You might be able to graft onto it. (I chatted with the team about this idea, they were not opposed as long as the foreign clients were well-behaving.)

                    1. 18

                      Even still, I wanted to share it because I’ve pushed really hard to get it to a minimally useful state to force myself to finally “finish” one of my ridiculous side projects.

                      I can relate to that. Congrats on getting this far!

                      1. 7

                        Thank you.

                      1. 4

                        Very cool, is there an explanation anywhere for how node addresses get mapped to IP addresses and what happens if those change?

                        1. 6

                          Each node keeps a routing table of other nodes at varying “distances” from itself (distance being the XOR of their addresses). It’s more complicated, but basically, that table works like a hashmap mapping addresses to IP.

                          Nodes are regularly announcing themselves to one another. When a node that you already have in your routing table announces itself to you, you update its IP.

                          Edit: thanks for checking it out!

                        1. 1

                          I usually have a pet project going on. Right now I’m working on a decentralized messaging protocol in Rust. Previously it was a Gameboy Z80 emulator.

                          Not being at the computer all weekend is also good. This year I’m mostly bicycling. I ride ~50-60 miles a week right now. A social ride for fun and making friends, and a training ride where I get my miles and climbing in, both at night during the week. When it’s not too hot, my gf and I usually go for a longer ride with some friends on the weekend.

                          I’m usually reading a book, and there’s usually an episode or two of a TV show squeezed in on weekends.

                          1. 3

                            I’m working on a Kaggle competition. The goal is to classify pictures of plankton to determine ocean health.

                            I’ve gotten a decent start using an SVM classifier on cropped, resized images, plus their FFT as features. I’m a little discouraged by how long the algorithm took to run (around 8 hours, I think) on my MacBook.

                            I’d like to iterate faster, but simpler models aren’t doing very well. Adding more features isn’t feasible because of how long it’s taking to run. Not sure what my next step should be: dimensionality reduction, or learning to parallelize. I’ve never made the jump to doing “big data.” I work on problems that can be done on my MacBook, so I’m not sure where to go in that direction.

                            This is one of two problems I run into when I work on these problems. The other is that I extract all the features I can think of, augment the data in any way I can think of, validate several models and go with the best, and finally optimize hyper parameters. After doing that, I don’t know where to go, but I’m still only in the top 30% on the leader board at best.

                            1. 4

                              sigh STI rears it’s ugly head. That’s not to say I don’t like this solution… I do. It’s nice and simple. I’m just always a bit wary when it’s introduced.

                              Anyway, there’s a bit of refactoring I would do. I would change:

                              # in ApplicationController#current_user
                              AnonymousUser.find_or_initialize_by_token(anonymous_user_token).tap do |user|
                                user.save(validate: false) if user.new_record?
                              end
                              

                              to something like this:

                              AnonymousUser.safely_find(anonymous_user_token)
                              

                              and push the find_or_initialize_by_token and save(validate: false) into the model.

                              1. 1

                                Moving the user lookup/create into the model is definitely a nice refactor. You’re right about STI—it usually gets ugly when you use it without necessity. I mostly went with it for clarity of demonstration. I personally prefer using roles to denote user traits.

                                1. 1

                                  Of Rails' open bugs, about half are ActiveRecord, and STI (from my rough estimate) are about a third of those.