mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
rldp-http-proxy: use tonlib
- rldp-http-proxy used TONLib to resolve domains via DNS smartcontract - updated tonlib - bugfixes
This commit is contained in:
parent
1de39f5d7c
commit
493ae2410c
34 changed files with 816 additions and 153 deletions
|
@ -22,15 +22,15 @@ in the build directory.
|
|||
|
||||
In order to access existing TON Sites, you need a running instance of RLDP-HTTP Proxy on your computer. It can be invoked as follows:
|
||||
|
||||
rldp-http-proxy/rldp-http-proxy -p 8080 -c 3333 -C ton-global.config.json
|
||||
rldp-http-proxy/rldp-http-proxy -p 8080 -c 3333 -C ton-global-lite-client.config.json
|
||||
|
||||
or
|
||||
|
||||
rldp-http-proxy/rldp-http-proxy -p 8080 -a <your_public_ip>:3333 -C ton-global.config.json
|
||||
rldp-http-proxy/rldp-http-proxy -p 8080 -a <your_public_ip>:3333 -C ton-global-lite-client.config.json
|
||||
|
||||
where <your_public_ip> is your public IPv4 address, provided you have one on your home computer. The TON Network global configuration file `ton-global.config.json` can be downloaded at https://test.ton.org/ton-global.config.json :
|
||||
where <your_public_ip> is your public IPv4 address, provided you have one on your home computer. The TON Network global configuration file `ton-global-lite-client.config.json` can be downloaded at https://test.ton.org/ton-global-lite-client.config.json :
|
||||
|
||||
wget https://test.ton.org/ton-global.config.json
|
||||
wget https://test.ton.org/ton-global-lite-client.config.json
|
||||
|
||||
In the above example, 8080 is the TCP port that will be listened to at localhost for incoming HTTP queries, and 3333 is the UDP port that will be used for all outbound and inbound RLDP and ADNL activity, i.e., for connecting to the TON Sites via the TON Network.
|
||||
|
||||
|
@ -56,9 +56,15 @@ attempts to download the main page of (TON) Site `test.ton` using the proxy at `
|
|||
|
||||
because TON Site `test.ton` is currently set up to be a mirror of Web Site https://test.ton.org.
|
||||
|
||||
You can also access TON Sites by means of their ADNL addresses by using fake domain `<adnl-addr>.adnl`:
|
||||
|
||||
curl -x 127.0.0.1:8080 http://untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy.adnl/
|
||||
|
||||
currently fetches the same TON Web page.
|
||||
|
||||
Alternatively, you can set up `localhost:8080` as a HTTP proxy in your browser. For example, if you use Firefox, visit [Setup] -> General -> Network Settings -> Settings -> Configure Proxy Access -> Manual Proxy configuration, and type "127.0.0.1" into the field "HTTP Proxy", and "8080" into the field "Port". If you don't have Firefox yet, visit https://www.getfirefox.com first.
|
||||
|
||||
Once you have set up `localhost:8080` as the HTTP proxy to be used in your browser, you can simply type the required URI, such as `http://test.ton`, in the navigation bar of your browser, and interact with the TON Site in the same way as with the usual Web Sites.
|
||||
Once you have set up `localhost:8080` as the HTTP proxy to be used in your browser, you can simply type the required URI, such as `http://test.ton` or `http://untzo7eat2h77xzfugxrfgfy3zbl5txomvetzke6fwr45lehvdkxauy.adnl/`, in the navigation bar of your browser, and interact with the TON Site in the same way as with the usual Web Sites.
|
||||
|
||||
4. Creating TON Sites
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -67,12 +73,29 @@ Most people will need just to access existing TON Sites, not to create new ones.
|
|||
|
||||
We suppose that you know already how to set up an ordinary web site, and that you have already configured one on your server, accepting incoming HTTP connections on TCP port <your-server-ip>:80, and defining the required TON Network domain name, say, `example.ton`, as the main domain name or an alias for your web site in the configuration of your web server.
|
||||
|
||||
After that, you first need to generate a persistent ADNL address for your server:
|
||||
|
||||
mkdir keyring
|
||||
|
||||
util/generate-random-id -m adnlid
|
||||
|
||||
You see something like
|
||||
|
||||
45061C1D4EC44A937D0318589E13C73D151D1CEF5D3C0E53AFBCF56A6C2FE2BD vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3
|
||||
|
||||
This is your newly-generated persistent ADNL address, in hexadecimal and user-friendly form. The corresponding private key is saved into file 45061...2DB in the current directory. Move it into the keyring directory:
|
||||
|
||||
mv 45061C1* keyring/
|
||||
|
||||
After that, you execute
|
||||
|
||||
rldp-http-proxy -a <your-server-ip>:3333 -L example.ton -C ton-global.config.json
|
||||
rldp-http-proxy -a <your-server-ip>:3333 -L '*' -C ton-global.config.json -A <your-adnl-address>
|
||||
|
||||
in the background (you can try this in a terminal at first, but if you want your TON Site to run permanently, you'll have to use options `-d` and `-l <log-file>` as well).
|
||||
(with <your-adnl-address> equal to 'vcqm...35f3' in this example) in the background (you can try this in a terminal at first, but if you want your TON Site to run permanently, you'll have to use options `-d` and `-l <log-file>` as well).
|
||||
|
||||
If all works properly, the RLDP-HTTP proxy will accept incoming HTTP queries from the TON Network via RLDP/ADNL running on UDP port 3333 (of course, you can use any other UDP port if you want to) of IPv4 address <your-server-ip> (in particular, if you are using a firewall, don't forget to allow `rldp-http-proxy` to receive and send UDP packets from this port), and it will forward these HTTP queries addressed to host `example.ton` to TCP port 80 at 127.0.0.1, i.e., to your ordinary Web server.
|
||||
If all works properly, the RLDP-HTTP proxy will accept incoming HTTP queries from the TON Network via RLDP/ADNL running on UDP port 3333 (of course, you can use any other UDP port if you want to) of IPv4 address <your-server-ip> (in particular, if you are using a firewall, don't forget to allow `rldp-http-proxy` to receive and send UDP packets from this port), and it will forward these HTTP queries addressed to all hosts (if you want to forward only specific hosts, change `-L '*'` to `-L <your hostname>`) to TCP port 80 at 127.0.0.1, i.e., to your ordinary Web server.
|
||||
|
||||
You can visit TON Site `http://<your-adnl-address>.adnl` (`http://vcqmha5j3ceve35ammfrhqty46rkhi455otydstv66pk2tmf7rl25f3.adnl` in this example) from a browser running on a client machine as explained in Sections 2 and 3 and check whether your TON Site is actually available to the public.
|
||||
|
||||
If you want to, you can register a TON DNS domain, such as 'example.ton', and create a record for this domain pointing to the persistent ADNL address of your TON Site. Then the RLDP-HTTP proxies running in client mode would resolve 'http://example.ton' as pointing to your ADNL address and will access your TON Site. The process of registration of TON DNS domains is described in a separate document.
|
||||
|
||||
You can visit TON Site `http://example.ton` from a browser running on a client machine as explained in Sections 2 and 3 and check whether your TON Site is actually available to the public.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue