Replying to Avatar hzrd149

Doing a little house cleaning today on my "Projects" directory and found this

https://github.com/hzrd149/hyper-http-proxy

Its a HTTP Proxy server for #hyperdht #holepunch.

This would be really cool to finish, because it would allow almost any app to start talking to hyper servers without needing to integrate hyperdht directly. similar to how #tor and #i2p proxies work :)

Unfortunately it has a bug, I wasn't able to get the built-in nodejs socket to connect to the hyperdht socket

This was a learning project for me so I don't really know what I'm doing with sockets and pipes. which is why I never got it working

The bug is here https://github.com/hzrd149/hyper-http-proxy/blob/master/src/agent.ts#L21-L63

Anyways, I don't have time right now to finish this. So if your someone who wants to play with #holepunch or knows a lot about Nodejs then maybe this is a good project to start with?

If no one wants to do it for free (understandable) I'm willing to pay 100k sats to the first person who fixes this project or creates a HTTP proxy that fits these requirements

- Runs on linux and takes less than 3-4 commands to setup

- Runs in docker (needed for start9 and Umbrel)

- Able to proxy HTTP requests to a holesail server

- Easiest way to test this is using "curl .hyper --proxy http://localhost:3128"

- (optional) http auth for the proxy

Reply here or send me a DM if you need more details

Well jokes on me because this code actually works, I just never finished it enough to fully test it

nostr:nevent1qvzqqqqqqypzqfngzhsvjggdlgeycm96x4emzjlwf8dyyzdfg4hefp89zpkdgz99qyghwumn8ghj7mn0wd68ytnhd9hx2tcprfmhxue69uhkummnw3ezuargv4ekzmt9vdshgtnfduhsqgxprey4pqkdfqf90a0nyz2vls6x8ae6pt3k8rmf7dhkhmrwd7clsy0z7jdy

So without further ado I present to you Hyper SOCKS5 Proxy

This is a SOCKS v5 proxy server that can automatically connect to HyperDHT node and Holesail servers. This is cool because it lets any application that already supports SOCKS5 or HTTP proxies ( mainly web browsers ) to connect to hyper nodes

Let me show you can example

First we have to startup a http server and use holesail to make it available on hyper

Next, on a different machine we can connect to it using hyper-socks5-proxy and configure FireFox to use the proxy

https://v.nostr.build/3bcbJMX7XbaWMdfA.mp4

NOTE: besides this example ( tested on my LAN ) I have not tested anything else. but in theory it should be possible to host relays over hyperdht

The reason I had to convert the hex connection string ( hyperdht pubkey ) into a bech32 address was because the maximum length for a domain name is 63 characters. and the connection string is 64...

But encoding it to bech32 with a 4 character prefix makes it only 58. Its identical to how nostr npubs are encoded

Anyways here are the links to the code if you want to play around with it

https://github.com/hzrd149/hyper-address ( https://hzrd149.github.io/hyper-address/ )

https://github.com/hzrd149/hyper-socks5-proxy

https://github.com/hzrd149/hyper-http-proxy

This is also available on my custom umbrel app store. If for some crazy reason you want to run my untested code on your lightning node ( please don't )

https://github.com/hzrd149/umbrel-community-app-store

#pear #hyperdht #holesail #proxy #socks5

Reply to this note

Please Login to reply.

Discussion

nostr:npub1h5t3asu90f2x48rxtcqkjvwhza7m6kngs7vjyanx8xqyswc6es2s4645z5 nostr:npub1h8nk2346qezka5cpm8jjh3yl5j88pf4ly2ptu7s6uu55wcfqy0wq36rpev you guys have used hyperdht the most. If you don't mind could you test this an tell me if it works on your computer. I don't want this to be a case of "well it works on my machine" 😀

It works flawlessly , let's gooo ⛵️

Snap. This is cool. I really need to look at holepunch more.

I watched the video but don't quite understand what's going on.

So you ended up with your browser being configured to use a proxy that gave it DNS resolution for .hyper URLs? How are these routed? The holepunch people are loud about it being P2P with no middle man but how do packages actually travel from the client to the server and back? I see you are using no ssl. Is your proxy encrypting with the .hyper URL's public key or something?

In short, I don't know.

I only have a vague idea of how hypercore works. I've looked at some of code but I don't know enough about IP and networking to fully understand it

It does seem to use encryption when connecting to another hypercore node and it does seem to be able to make a direct P2P connection to another node ( at least a lot more than WebRTC can )

But I doubt this as private as Tor or I2P since they seem to be using NAT and holepunching to connect the machines. which probably exposes your IP address to other the peer

I simply built this on top of the `holesail` and `hyperdht` packages that seem to work really well from my testing 😀

with hyperswarm A establishes a connection to B using some dht nodes to help punch holes, then A and B negotiate a noise channel, from there you can send and receive anything, encrypted TCP

it's not pure p2p because you need someone to help with the holepunch and I imagine currently these helpful dht nodes are ran by the people behind the project

It is pure P2P, the nodes do not help in holepunching but to discover first few peers, a node is just a known peer. Anyone can become a node.

You need to look into Kademliya algorithem to understand how it all works.

I think you might be too dumb to continue this conversation, but holepunching requires a third party by definition so Ill leave it up to you to tell me who does it in this case

Perhaps you are too smart to understand, but I will try:

Unlike traditional and common holepunching methods, there is no requirement of a third party STUN server in Kademliya.

The peers themselves act as a stun themselves(kind of) and help in holepunching.

Check out Kademliya algorithem, it is truly peer to peer, there are no central nodes.

Freaking heck I just tested it, and it works. This is so cool.

Check this out, guys, It's the coolest thing by far I have seen build-on holesail.

nostr:note10em22c0rr0cjwd5ndy7rl76u8m2z6my2t7y0qpyfhvv5crg4g9nsqhkx03

Also since this is custom DNS resolution I dont think we need to convert to bech32 🤔

Technically no, although there is no way to know if browsers or other apps have restrictions on domain length. could be even some libraries restrict it to 63 char

Even Tor .onion and I2P domains are encoded to be less than 63 char

Okay lets see if this works. I setup a server and made it available on hypercore using #holesail

Its connection string is 066ed92add0f1b000409816229bfcb6bcf9bdf3ec0d73ff010a61d688fe4e830

For anyone who has nodejs installed, There are two things I want you to test

First connecting to the node using holesail cli. You can do this by running the `npx holesail 066ed92add0f1b000409816229bfcb6bcf9bdf3ec0d73ff010a61d688fe4e830` command then opening http://127.0.0.1:8989/

If it worked you should see the nginx welcome page 🎉

Next I want to test using the SOCKS5 proxy I built

To start the proxy you can run `npx hyper-socks5-proxy start` then you will have to follow the instructions in this note to configure FireFox to use that proxy

nostr:nevent1qvzqqqqqqypzqfngzhsvjggdlgeycm96x4emzjlwf8dyyzdfg4hefp89zpkdgz99qyghwumn8ghj7mn0wd68ytnhd9hx2tcprfmhxue69uhkummnw3ezuargv4ekzmt9vdshgtnfduhsqgr7w6jkrccm7ynndymf8sllkhp76skkezjl3rcqfzdmr9xq692pvuppkk2f

Once you have firefox setup you should be able to go to this address http://hypr1qehdj2kapudsqpqfs93zn07td08ehhe7crtnluqs5cwk3rlyaqcqdhsfwd.hyper/ and see the nginx welcome page 🎉

Let me know if you were able to connect, and if not what error you got

nostr:npub1h5t3asu90f2x48rxtcqkjvwhza7m6kngs7vjyanx8xqyswc6es2s4645z5 nostr:npub1h8nk2346qezka5cpm8jjh3yl5j88pf4ly2ptu7s6uu55wcfqy0wq36rpev and anyone else who is interested

Lots of people over on keet and holesail.io have been interested in bridging nostr to holepunch for a while.

I'm sure GuySwann would love to check this out.

Join me on Keet.io - The Psychedelic Libertarian Repository (no expiry)

pear://keet/yry5f6hctja4dwbmpfxbpngqgjp6oiz3hqtzhimcseumfusi3koaeykkdtpe7u4pkubpkt4tykmjrpknr5an9ncjnw63w711x1q8pmkeqc