pushed commit for remote map port
This commit is contained in:
@@ -135,11 +135,11 @@ func EscapeFirewall(HostOutsideNATIP string, HostOutsideNATPort string, internal
|
||||
|
||||
//export MapPort
|
||||
func MapPort(Port string, DomainName string, ServerAddress string) *C.char {
|
||||
entireAddress, _, err := abstractions.MapPort(Port, DomainName, ServerAddress)
|
||||
Address, err := abstractions.MapPort(Port, DomainName, ServerAddress)
|
||||
if err != nil {
|
||||
return C.CString(err.Error())
|
||||
}
|
||||
return C.CString(entireAddress)
|
||||
return C.CString(Address.EntireAddress)
|
||||
}
|
||||
|
||||
// --------------------------------- Controlling Server ----------------------------------------
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
* Contributing
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: contributing
|
||||
:END:
|
||||
When contributing to this repository, please first discuss the change
|
||||
you wish to make via issue, email, or any other method with the owners
|
||||
of this repository before making a change.
|
||||
|
||||
Please note we have a code of conduct, please follow it in all your
|
||||
interactions with the project.
|
||||
|
||||
** Pull Request Process
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: pull-request-process
|
||||
:END:
|
||||
1. Ensure any install or build dependencies are removed before the end
|
||||
of the layer when doing a build.
|
||||
2. Update the appropriate docs before stating the changes you did.
|
||||
3. You may merge the Pull Request in once you have the approval of
|
||||
CODEOWNER, or if you do not have permission to do that, you may
|
||||
request the second reviewer to merge it for you.
|
||||
|
||||
** Code of conduct
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: code-of-conduct
|
||||
:END:
|
||||
All projects(including mailing lists) at HWTechClub is required to
|
||||
follow [[https://lunduke.com/pages/codeofconduct/][The Lunduke Code of
|
||||
Conduct]].
|
||||
|
||||
*** The Lunduke Code of Conduct
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: the-lunduke-code-of-conduct
|
||||
:END:
|
||||
|
||||
#+begin_quote
|
||||
**** "Be Excellent to Each Other."
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: be-excellent-to-each-other.
|
||||
:END:
|
||||
#+end_quote
|
||||
|
||||
***** FAQ
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: faq
|
||||
:END:
|
||||
*Q*: Wait. That's it?
|
||||
|
||||
A: Yup.
|
||||
|
||||
*Q*: But... but... it's only 5 words!
|
||||
|
||||
A: It is? Cool!
|
||||
|
||||
*Q*: Isn't that too short to be a viable Code of Conduct?
|
||||
|
||||
A: Nah.
|
||||
|
||||
*Q*: It's too vague! How would you enforce this?!?
|
||||
|
||||
A: By being excellent to each other.
|
||||
|
||||
*Q*: What if someone violates this Code of Conduct?
|
||||
|
||||
A: I trust you to figure it out.
|
||||
|
||||
*Q*: What if someone talks about politics I disagree with?!?!!?
|
||||
|
||||
A: I know a guy who votes for Papa Smurf in every Presidential election.
|
||||
He's a pretty cool dude.
|
||||
|
||||
*Q*: I'm super angry about something! And a person likes the thing
|
||||
making me angry! What do I do?
|
||||
|
||||
A: I dunno. Try /hugs/?
|
||||
|
||||
*Q*: Are virtual hugs (such as /"hugs"/ and animated .GIFs of teddy
|
||||
bears hugging) excellent?
|
||||
|
||||
A: Most excellent.
|
||||
|
||||
*Q*: Huh. Seems so simple!
|
||||
|
||||
A: I know, right?
|
||||
|
||||
*Q*: I like you!
|
||||
|
||||
A: I like you, too!
|
||||
|
||||
/The Lunduke Code of Conduct is free for you to use however you like./
|
||||
|
||||
*Source*: [[https://lunduke.com/pages/codeofconduct/][The Lunduke Code
|
||||
of Conduct]]
|
||||
144
Docs/index.html
144
Docs/index.html
@@ -3,7 +3,7 @@
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||||
<head>
|
||||
<!-- 2025-01-21 Tue 21:04 -->
|
||||
<!-- 2025-01-24 Fri 15:22 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>‎</title>
|
||||
@@ -12,7 +12,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="src/readtheorg_theme/css/search.css"/>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.1.3/jquery.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js"></script>
|
||||
<script type="text/javascript" src="https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/search.js"></script>
|
||||
@@ -70,7 +70,7 @@
|
||||
<li><a href="#pulling-plugin-from-a-remote-repo">3.0.17. Pulling plugin from a remote repo</a></li>
|
||||
<li><a href="#deleting-plugin-from-the-plugin-directory">3.0.18. Deleting plugin from the plugin directory</a></li>
|
||||
<li><a href="#added-custom-metadata-about-the-current-node">3.0.19. Added custom metadata about the current node</a></li>
|
||||
<li><a href="#org4d721f8">3.0.20. MapPort and link to domain name</a></li>
|
||||
<li><a href="#orgb855f23">3.0.20. MapPort and link to domain name</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -100,7 +100,8 @@
|
||||
</li>
|
||||
<li><a href="#current-languages-supported">5.3. Current languages supported</a>
|
||||
<ul>
|
||||
<li><a href="#build-sample-python-program">5.3.1. Build sample python program</a></li>
|
||||
<li><a href="#orgf92e89c">5.3.1. Python</a></li>
|
||||
<li><a href="#orge1fbb06">5.3.2. Haskell</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -117,13 +118,13 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#client-mode">9. Client mode</a></li>
|
||||
<li><a href="#org7d101da">10. Ideas for future potencial features</a>
|
||||
<li><a href="#org69c4bb8">10. Ideas for future potencial features</a>
|
||||
<ul>
|
||||
<li><a href="#org06835d7">10.1. To support hetrogenous set of Nodes that cannot run P2PRC</a>
|
||||
<li><a href="#org28b6a88">10.1. To support hetrogenous set of Nodes that cannot run P2PRC</a>
|
||||
<ul>
|
||||
<li><a href="#org4567f0b">10.1.1. Assumptions:</a></li>
|
||||
<li><a href="#orgc9b25fd">10.1.2. Set of interesting possible:</a></li>
|
||||
<li><a href="#org2d3c880">10.1.3. Implementation</a></li>
|
||||
<li><a href="#org9828db6">10.1.1. Assumptions:</a></li>
|
||||
<li><a href="#org8d83427">10.1.2. Set of interesting possible:</a></li>
|
||||
<li><a href="#orgf69dcfb">10.1.3. Implementation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -230,7 +231,7 @@ Go API to create and interact with the containers.
|
||||
to install docker GPU</a>
|
||||
</p>
|
||||
|
||||
<pre class="example" id="org2b9a835">
|
||||
<pre class="example" id="orgc21d8e1">
|
||||
// Do ensure that the docker command does not need sudo to run
|
||||
sudo chmod 666 /var/run/docker.sock
|
||||
</pre>
|
||||
@@ -245,7 +246,7 @@ To set up the internal dependencies and build the entire go code into a
|
||||
single binary
|
||||
</p>
|
||||
|
||||
<pre class="example" id="org3848c1f">
|
||||
<pre class="example" id="org0a24712">
|
||||
make install
|
||||
</pre>
|
||||
</div>
|
||||
@@ -258,7 +259,7 @@ To set up P2PRC on Windows, simply run this batch file. <b>Make sure you
|
||||
are not in admin mode when running this.</b>
|
||||
</p>
|
||||
|
||||
<pre class="example" id="orgfa94624">
|
||||
<pre class="example" id="org16c6fc1">
|
||||
.\install.bat
|
||||
</pre>
|
||||
</div>
|
||||
@@ -269,7 +270,7 @@ are not in admin mode when running this.</b>
|
||||
<div id="outline-container-add-appropriate-paths-to-.bashrc" class="outline-4">
|
||||
<h4 id="add-appropriate-paths-to-.bashrc"><span class="section-number-4">2.2.4.</span> Add appropriate paths to <code>.bashrc</code></h4>
|
||||
<div class="outline-text-4" id="text-add-appropriate-paths-to-.bashrc">
|
||||
<pre class="example" id="orgb5d26ac">
|
||||
<pre class="example" id="org2b22546">
|
||||
export P2PRC=/<PATH>/p2p-rendering-computation
|
||||
export PATH=/<PATH>/p2p-rendering-computation:${PATH}
|
||||
</pre>
|
||||
@@ -279,7 +280,7 @@ export PATH=/<PATH>/p2p-rendering-computation:${PATH}
|
||||
<div id="outline-container-set-up-configuration-file" class="outline-4">
|
||||
<h4 id="set-up-configuration-file"><span class="section-number-4">2.2.5.</span> Set up configuration file</h4>
|
||||
<div class="outline-text-4" id="text-set-up-configuration-file">
|
||||
<pre class="example" id="org2c31c8d">
|
||||
<pre class="example" id="org9d41273">
|
||||
make configfile
|
||||
</pre>
|
||||
|
||||
@@ -293,7 +294,7 @@ one.
|
||||
<div id="outline-container-test-if-binary-works" class="outline-4">
|
||||
<h4 id="test-if-binary-works"><span class="section-number-4">2.2.6.</span> Test if binary works</h4>
|
||||
<div class="outline-text-4" id="text-test-if-binary-works">
|
||||
<pre class="example" id="orga8c9dc7">
|
||||
<pre class="example" id="orgd762c0d">
|
||||
p2prc --help
|
||||
</pre>
|
||||
</div>
|
||||
@@ -301,7 +302,7 @@ p2prc --help
|
||||
<ol class="org-ol">
|
||||
<li><a id="output"></a>Output:<br />
|
||||
<div class="outline-text-5" id="text-output">
|
||||
<pre class="example" id="org43fa70b">
|
||||
<pre class="example" id="org02ab2e2">
|
||||
NAME:
|
||||
p2p-rendering-computation - p2p cli application to create and access VMs in other servers
|
||||
|
||||
@@ -364,7 +365,7 @@ GLOBAL OPTIONS:
|
||||
<div id="outline-container-start-as-a-server" class="outline-4">
|
||||
<h4 id="start-as-a-server"><span class="section-number-4">3.0.1.</span> Start as a server</h4>
|
||||
<div class="outline-text-4" id="text-start-as-a-server">
|
||||
<pre class="example" id="org2bd2f86">
|
||||
<pre class="example" id="orgc846811">
|
||||
p2prc -s
|
||||
</pre>
|
||||
</div>
|
||||
@@ -373,7 +374,7 @@ p2prc -s
|
||||
<div id="outline-container-view-server-specification" class="outline-4">
|
||||
<h4 id="view-server-specification"><span class="section-number-4">3.0.2.</span> View server Specification</h4>
|
||||
<div class="outline-text-4" id="text-view-server-specification">
|
||||
<pre class="example" id="org7c931ca">
|
||||
<pre class="example" id="org019088b">
|
||||
p2prc --specs=<ip address>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -386,7 +387,7 @@ p2prc --specs=<ip address>
|
||||
use the <code>--gpu</code> if you know the other machine has a gpu.
|
||||
</p>
|
||||
|
||||
<pre class="example" id="org2d6ca33">
|
||||
<pre class="example" id="org7085fb8">
|
||||
p2prc --touch=<server ip address> -p <number of ports> --gpu
|
||||
</pre>
|
||||
</div>
|
||||
@@ -399,7 +400,7 @@ p2prc --touch=<server ip address> -p <number of ports> --gpu
|
||||
The docker id is present in the output where you create a container
|
||||
</p>
|
||||
|
||||
<pre class="example" id="orgbb6bc6f">
|
||||
<pre class="example" id="orge995039">
|
||||
p2prc --rm=<server ip address> --id=<docker container id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -408,7 +409,7 @@ p2prc --rm=<server ip address> --id=<docker container id>
|
||||
<div id="outline-container-adding-servers-to-ip-table" class="outline-4">
|
||||
<h4 id="adding-servers-to-ip-table"><span class="section-number-4">3.0.5.</span> Adding servers to ip table</h4>
|
||||
<div class="outline-text-4" id="text-adding-servers-to-ip-table">
|
||||
<pre class="example" id="org170cd43">
|
||||
<pre class="example" id="org598fea7">
|
||||
p2prc --as=<server ip address you want to add>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -417,7 +418,7 @@ p2prc --as=<server ip address you want to add>
|
||||
<div id="outline-container-update-ip-table" class="outline-4">
|
||||
<h4 id="update-ip-table"><span class="section-number-4">3.0.6.</span> Update ip table</h4>
|
||||
<div class="outline-text-4" id="text-update-ip-table">
|
||||
<pre class="example" id="org876e38e">
|
||||
<pre class="example" id="org3f5c136">
|
||||
p2prc --us
|
||||
</pre>
|
||||
</div>
|
||||
@@ -426,7 +427,7 @@ p2prc --us
|
||||
<div id="outline-container-list-servers" class="outline-4">
|
||||
<h4 id="list-servers"><span class="section-number-4">3.0.7.</span> List Servers</h4>
|
||||
<div class="outline-text-4" id="text-list-servers">
|
||||
<pre class="example" id="orgdd0eeb2">
|
||||
<pre class="example" id="org5fd6ddf">
|
||||
p2prc --ls
|
||||
</pre>
|
||||
</div>
|
||||
@@ -435,7 +436,7 @@ p2prc --ls
|
||||
<div id="outline-container-view-network-interfaces" class="outline-4">
|
||||
<h4 id="view-network-interfaces"><span class="section-number-4">3.0.8.</span> View Network interfaces</h4>
|
||||
<div class="outline-text-4" id="text-view-network-interfaces">
|
||||
<pre class="example" id="org243ab03">
|
||||
<pre class="example" id="org58324dd">
|
||||
p2prc --ni
|
||||
</pre>
|
||||
</div>
|
||||
@@ -444,7 +445,7 @@ p2prc --ni
|
||||
<div id="outline-container-viewing-containers-created-client-side" class="outline-4">
|
||||
<h4 id="viewing-containers-created-client-side"><span class="section-number-4">3.0.9.</span> Viewing Containers created Client side</h4>
|
||||
<div class="outline-text-4" id="text-viewing-containers-created-client-side">
|
||||
<pre class="example" id="org8af9ef6">
|
||||
<pre class="example" id="org4220438">
|
||||
p2prc --tc
|
||||
</pre>
|
||||
</div>
|
||||
@@ -453,7 +454,7 @@ p2prc --tc
|
||||
<div id="outline-container-running-plugin" class="outline-4">
|
||||
<h4 id="running-plugin"><span class="section-number-4">3.0.10.</span> Running plugin</h4>
|
||||
<div class="outline-text-4" id="text-running-plugin">
|
||||
<pre class="example" id="orgbff8598">
|
||||
<pre class="example" id="org77295aa">
|
||||
p2prc --plugin <plugin name> --id <container id or group id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -462,7 +463,7 @@ p2prc --plugin <plugin name> --id <container id or group id>
|
||||
<div id="outline-container-create-group" class="outline-4">
|
||||
<h4 id="create-group"><span class="section-number-4">3.0.11.</span> Create group</h4>
|
||||
<div class="outline-text-4" id="text-create-group">
|
||||
<pre class="example" id="org632e74b">
|
||||
<pre class="example" id="org86fcb74">
|
||||
p2prc --cgroup
|
||||
</pre>
|
||||
</div>
|
||||
@@ -471,7 +472,7 @@ p2prc --cgroup
|
||||
<div id="outline-container-add-container-to-group" class="outline-4">
|
||||
<h4 id="add-container-to-group"><span class="section-number-4">3.0.12.</span> Add container to group</h4>
|
||||
<div class="outline-text-4" id="text-add-container-to-group">
|
||||
<pre class="example" id="orga449f41">
|
||||
<pre class="example" id="org564f6e3">
|
||||
p2prc --group <group id> --id <container id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -480,7 +481,7 @@ p2prc --group <group id> --id <container id>
|
||||
<div id="outline-container-view-groups" class="outline-4">
|
||||
<h4 id="view-groups"><span class="section-number-4">3.0.13.</span> View groups</h4>
|
||||
<div class="outline-text-4" id="text-view-groups">
|
||||
<pre class="example" id="orgd9b0b62">
|
||||
<pre class="example" id="org9e4cebf">
|
||||
p2prc --groups
|
||||
</pre>
|
||||
</div>
|
||||
@@ -489,7 +490,7 @@ p2prc --groups
|
||||
<div id="outline-container-view-specific-group" class="outline-4">
|
||||
<h4 id="view-specific-group"><span class="section-number-4">3.0.14.</span> View specific group</h4>
|
||||
<div class="outline-text-4" id="text-view-specific-group">
|
||||
<pre class="example" id="org830d644">
|
||||
<pre class="example" id="org96be349">
|
||||
p2prc --group <group id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -498,7 +499,7 @@ p2prc --group <group id>
|
||||
<div id="outline-container-delete-container-from-group" class="outline-4">
|
||||
<h4 id="delete-container-from-group"><span class="section-number-4">3.0.15.</span> Delete container from group</h4>
|
||||
<div class="outline-text-4" id="text-delete-container-from-group">
|
||||
<pre class="example" id="orgbd4b1bd">
|
||||
<pre class="example" id="org4760913">
|
||||
p2prc --rmcgroup --group <group id> --id <container id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -507,7 +508,7 @@ p2prc --rmcgroup --group <group id> --id <container id>
|
||||
<div id="outline-container-delete-entire-group" class="outline-4">
|
||||
<h4 id="delete-entire-group"><span class="section-number-4">3.0.16.</span> Delete entire group</h4>
|
||||
<div class="outline-text-4" id="text-delete-entire-group">
|
||||
<pre class="example" id="org51c6a57">
|
||||
<pre class="example" id="orgf7d1f9f">
|
||||
p2prc --rmgroup <group id>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -516,7 +517,7 @@ p2prc --rmgroup <group id>
|
||||
<div id="outline-container-pulling-plugin-from-a-remote-repo" class="outline-4">
|
||||
<h4 id="pulling-plugin-from-a-remote-repo"><span class="section-number-4">3.0.17.</span> Pulling plugin from a remote repo</h4>
|
||||
<div class="outline-text-4" id="text-pulling-plugin-from-a-remote-repo">
|
||||
<pre class="example" id="org3fbde07">
|
||||
<pre class="example" id="org0e04637">
|
||||
p2prc --pp <repo link>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -525,7 +526,7 @@ p2prc --pp <repo link>
|
||||
<div id="outline-container-deleting-plugin-from-the-plugin-directory" class="outline-4">
|
||||
<h4 id="deleting-plugin-from-the-plugin-directory"><span class="section-number-4">3.0.18.</span> Deleting plugin from the plugin directory</h4>
|
||||
<div class="outline-text-4" id="text-deleting-plugin-from-the-plugin-directory">
|
||||
<pre class="example" id="org82c6951">
|
||||
<pre class="example" id="orgcaad077">
|
||||
p2prc --rp <plugin name>
|
||||
</pre>
|
||||
</div>
|
||||
@@ -534,16 +535,16 @@ p2prc --rp <plugin name>
|
||||
<div id="outline-container-added-custom-metadata-about-the-current-node" class="outline-4">
|
||||
<h4 id="added-custom-metadata-about-the-current-node"><span class="section-number-4">3.0.19.</span> Added custom metadata about the current node</h4>
|
||||
<div class="outline-text-4" id="text-added-custom-metadata-about-the-current-node">
|
||||
<pre class="example" id="org99a9b6f">
|
||||
<pre class="example" id="org19ce94c">
|
||||
p2prc --amd "custom metadata"
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4d721f8" class="outline-4">
|
||||
<h4 id="org4d721f8"><span class="section-number-4">3.0.20.</span> MapPort and link to domain name</h4>
|
||||
<div id="outline-container-orgb855f23" class="outline-4">
|
||||
<h4 id="orgb855f23"><span class="section-number-4">3.0.20.</span> MapPort and link to domain name</h4>
|
||||
<div class="outline-text-4" id="text-3-0-20">
|
||||
<pre class="example" id="org5df74b1">
|
||||
<pre class="example" id="orgcb5f862">
|
||||
p2prc --mp <port no to map> --dn <domain name to link Mapped port against>
|
||||
</pre>
|
||||
|
||||
@@ -564,7 +565,7 @@ servers with optimal performance, enhancing their overall network experience.
|
||||
</p>
|
||||
|
||||
|
||||
<div id="orgbc346b6" class="figure">
|
||||
<div id="org7def4d5" class="figure">
|
||||
<p><img src="images/p2pmoduleArch.png" alt="p2pmoduleArch.png" />
|
||||
</p>
|
||||
<p><span class="figure-number">Figure 1: </span>UML diagram of P2P module</p>
|
||||
@@ -665,7 +666,7 @@ from the TURN server. The flow below describes the workflow.
|
||||
<li>Call <code>/FRPPort</code></li>
|
||||
</ul>
|
||||
|
||||
<pre class="example" id="org43a6567">
|
||||
<pre class="example" id="orgdf194ca">
|
||||
http://<turn server ip>:<server port no>/FRPport
|
||||
</pre>
|
||||
|
||||
@@ -759,7 +760,7 @@ p2prc.h p2prc.so
|
||||
Below are a sample set of commands to open the bindings implementation.
|
||||
</p>
|
||||
|
||||
<pre class="example" id="orgbf9803e">
|
||||
<pre class="example" id="orgad17e1e">
|
||||
# run
|
||||
cd Bindings/
|
||||
# list files
|
||||
@@ -853,7 +854,7 @@ that convert a go object to JSON string initially and converts it to
|
||||
|
||||
<li><a id="a-pseudo-code-to-refer-to-the-common-function-implementation-shape-could-be-represented-as"></a>A Pseudo code to refer to the common function implementation shape could be represented as:<br />
|
||||
<div class="outline-text-5" id="text-a-pseudo-code-to-refer-to-the-common-function-implementation-shape-could-be-represented-as">
|
||||
<pre class="example" id="org125b0a6">
|
||||
<pre class="example" id="org1b91e81">
|
||||
func <Function name> (output *C.char) {
|
||||
<response>,<error> := <P2PRC function name>(<parameters if needed>)
|
||||
if <error> != nil {
|
||||
@@ -871,14 +872,14 @@ func <Function name> (output *C.char) {
|
||||
<div id="outline-container-current-languages-supported" class="outline-3">
|
||||
<h3 id="current-languages-supported"><span class="section-number-3">5.3.</span> Current languages supported</h3>
|
||||
<div class="outline-text-3" id="text-current-languages-supported">
|
||||
<ul class="org-ul">
|
||||
<li>Python</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-build-sample-python-program" class="outline-4">
|
||||
<h4 id="build-sample-python-program"><span class="section-number-4">5.3.1.</span> Build sample python program</h4>
|
||||
<div class="outline-text-4" id="text-build-sample-python-program">
|
||||
<div id="outline-container-orgf92e89c" class="outline-4">
|
||||
<h4 id="orgf92e89c"><span class="section-number-4">5.3.1.</span> Python</h4>
|
||||
<div class="outline-text-4" id="text-5-3-1">
|
||||
</div>
|
||||
<ol class="org-ol">
|
||||
<li><a id="build-sample-python-program"></a>Build sample python program<br />
|
||||
<div class="outline-text-5" id="text-build-sample-python-program">
|
||||
<p>
|
||||
The easier way
|
||||
</p>
|
||||
@@ -907,10 +908,25 @@ scripted or used a reference point as proof of concept that P2PRC can be
|
||||
called from other programming languages.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge1fbb06" class="outline-4">
|
||||
<h4 id="orge1fbb06"><span class="section-number-4">5.3.2.</span> Haskell</h4>
|
||||
<div class="outline-text-4" id="text-5-3-2">
|
||||
<p>
|
||||
P2PRC officially supports Haskell bindings and will further support
|
||||
project using Haskell to build orchestrators on top of P2PRC.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="https://p2prc.akilan.io/Docs/haskell">Read more…</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-config-implementation" class="outline-2">
|
||||
<h2 id="config-implementation"><span class="section-number-2">6.</span> Config Implementation</h2>
|
||||
@@ -1015,7 +1031,7 @@ from the TURN server. The flow below describes the workflow.
|
||||
<li>Call <code>/FRPPort</code></li>
|
||||
</ul>
|
||||
|
||||
<pre class="example" id="orgde2b494">
|
||||
<pre class="example" id="org211622f">
|
||||
http://<turn server ip>:<server port no>/FRPport
|
||||
</pre>
|
||||
|
||||
@@ -1051,8 +1067,8 @@ func main() {
|
||||
|
||||
|
||||
|
||||
<div id="outline-container-org7d101da" class="outline-2">
|
||||
<h2 id="org7d101da"><span class="section-number-2">10.</span> Ideas for future potencial features</h2>
|
||||
<div id="outline-container-org69c4bb8" class="outline-2">
|
||||
<h2 id="org69c4bb8"><span class="section-number-2">10.</span> Ideas for future potencial features</h2>
|
||||
<div class="outline-text-2" id="text-10">
|
||||
<p>
|
||||
Consists of personal loideas for the future of P2PRC.
|
||||
@@ -1060,8 +1076,8 @@ At moment only has main contributors writiing to this.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org06835d7" class="outline-3">
|
||||
<h3 id="org06835d7"><span class="section-number-3">10.1.</span> To support hetrogenous set of Nodes that cannot run P2PRC</h3>
|
||||
<div id="outline-container-org28b6a88" class="outline-3">
|
||||
<h3 id="org28b6a88"><span class="section-number-3">10.1.</span> To support hetrogenous set of Nodes that cannot run P2PRC</h3>
|
||||
<div class="outline-text-3" id="text-10-1">
|
||||
<p>
|
||||
This stems from a personal issue I have when doing research
|
||||
@@ -1078,8 +1094,8 @@ network nodes.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4567f0b" class="outline-4">
|
||||
<h4 id="org4567f0b"><span class="section-number-4">10.1.1.</span> Assumptions:</h4>
|
||||
<div id="outline-container-org9828db6" class="outline-4">
|
||||
<h4 id="org9828db6"><span class="section-number-4">10.1.1.</span> Assumptions:</h4>
|
||||
<div class="outline-text-4" id="text-10-1-1">
|
||||
<ul class="org-ul">
|
||||
<li>I have a Morello board that cannot run P2PRC</li>
|
||||
@@ -1092,8 +1108,8 @@ as well look into custom tasks into the hetrogenous hardware.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgc9b25fd" class="outline-4">
|
||||
<h4 id="orgc9b25fd"><span class="section-number-4">10.1.2.</span> Set of interesting possible:</h4>
|
||||
<div id="outline-container-org8d83427" class="outline-4">
|
||||
<h4 id="org8d83427"><span class="section-number-4">10.1.2.</span> Set of interesting possible:</h4>
|
||||
<div class="outline-text-4" id="text-10-1-2">
|
||||
<p>
|
||||
We build a cool set possibilities before and use this to build up the implementation
|
||||
@@ -1110,8 +1126,8 @@ weight hypervisors.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org2d3c880" class="outline-4">
|
||||
<h4 id="org2d3c880"><span class="section-number-4">10.1.3.</span> Implementation</h4>
|
||||
<div id="outline-container-orgf69dcfb" class="outline-4">
|
||||
<h4 id="orgf69dcfb"><span class="section-number-4">10.1.3.</span> Implementation</h4>
|
||||
<div class="outline-text-4" id="text-10-1-3">
|
||||
<ul class="org-ul">
|
||||
<li>To use implementations similar to <a href="https://linux.die.net/man/1/socat">socat</a> to ensure we can bind address of local
|
||||
@@ -1125,7 +1141,7 @@ other nodes can access the Morello board who have permission access.</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<div id="org2359681" class="figure">
|
||||
<div id="org0c416ff" class="figure">
|
||||
<p><img src="./images/P2PRCRemoteNodes.png" alt="P2PRCRemoteNodes.png" />
|
||||
</p>
|
||||
<p><span class="figure-number">Figure 2: </span>Implementation idea (To be improved upon)</p>
|
||||
@@ -1137,7 +1153,7 @@ other nodes can access the Morello board who have permission access.</li>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: Akilan</p>
|
||||
<p class="date">Created: 2025-01-21 Tue 21:04</p>
|
||||
<p class="date">Created: 2025-01-24 Fri 15:22</p>
|
||||
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -351,9 +351,15 @@ p2prc --amd "custom metadata"
|
||||
#+end_example
|
||||
|
||||
*** MapPort and link to domain name
|
||||
Allows to expose remote ports from a machine in the P2P network.
|
||||
#+begin_example
|
||||
p2prc --mp <port no to map> --dn <domain name to link Mapped port against>
|
||||
#+end_example
|
||||
**** MapPort in remote machine
|
||||
This is to ensure ports on remote machines on the P2PRC can be easily opened.
|
||||
#+begin_example
|
||||
p2prc --mp <port no to map> --dn <domain name to link Mapped port against> --ra <remote server address>
|
||||
#+end_example
|
||||
|
||||
--------------
|
||||
|
||||
@@ -628,9 +634,9 @@ func <Function name> (output *C.char) {
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: current-languages-supported
|
||||
:END:
|
||||
- Python
|
||||
*** Python
|
||||
|
||||
*** Build sample python program
|
||||
**** Build sample python program
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: build-sample-python-program
|
||||
:END:
|
||||
@@ -657,6 +663,11 @@ folder can copied and created as a new git repo for P2PRC extensions
|
||||
scripted or used a reference point as proof of concept that P2PRC can be
|
||||
called from other programming languages.
|
||||
|
||||
*** Haskell
|
||||
P2PRC officially supports Haskell bindings and will further support
|
||||
project using Haskell to build orchestrators on top of P2PRC.
|
||||
|
||||
[[https://p2prc.akilan.io/Docs/haskell][Read more...]]
|
||||
|
||||
* Config Implementation
|
||||
:PROPERTIES:
|
||||
252
README.md.org
252
README.md.org
@@ -1,252 +0,0 @@
|
||||
#+begin_quote
|
||||
[!TIP] Haskell bindings supported!:
|
||||
[[https://p2prc.akilan.io/Docs/haskell/P2PRC.html][Bindings
|
||||
documentaton]]
|
||||
|
||||
#+end_quote
|
||||
|
||||
#+begin_quote
|
||||
[!NOTE] Fixing documentation to latest changes. If you have any
|
||||
questions setting up P2PRC either
|
||||
[[https://github.com/Akilan1999/p2p-rendering-computation/issues/new/choose][create
|
||||
an issue]] or send me an email (me AT akilan dot io). Currently HEAD is
|
||||
always intended to stay on a working state. It is recommended to always
|
||||
use HEAD in your go.mod file.
|
||||
|
||||
#+end_quote
|
||||
|
||||
#+begin_html
|
||||
<h1 align="center">
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
</h1>
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- seperator -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- The main aim of this project was to create a custom peer to peer network. The user acting as the
|
||||
client has total flexibility on how to batch the tasks and the user acting as the server has complete
|
||||
flexibility on tracking the container's usages and killing the containers at any point of time. -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- The objective is to allow users to self host servers in easier
|
||||
and abstracted manner. The main aim of this project was to create a custom peer to peer network for distributed computing. The user acting as the client has total flexibility on how to batch the tasks to any of nodes in networks. These nodes can anywhere from personal
|
||||
computers behind NAT to custom hardware for running custom workload. The aim to provide
|
||||
access to Heterogeneous set of nodes as a singular global list and abstract away the networking details giving the user focus on designing a custom orchestrator based
|
||||
on the requirements of a user. -->
|
||||
#+end_html
|
||||
|
||||
This project aims to simplify self-hosting servers and streamline the
|
||||
creation of distributed systems. The primary focus is to enable users to
|
||||
design custom peer-to-peer networks for distributed computing, offering
|
||||
full flexibility and control while abstracting away the complexities of
|
||||
networking.
|
||||
|
||||
** Key Features
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: key-features
|
||||
:END:
|
||||
Simplified Self-Hosting Empower users to easily host nodes, whether on
|
||||
personal computers behind NAT, custom hardware, or cloud-based
|
||||
infrastructure.
|
||||
|
||||
*** Custom Peer-to-Peer Networks
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: custom-peer-to-peer-networks
|
||||
:END:
|
||||
Build a decentralised network tailored to user requirements, enabling
|
||||
distributed task execution without the need for in-depth networking
|
||||
knowledge.
|
||||
|
||||
*** Heterogeneous Node Support
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: heterogeneous-node-support
|
||||
:END:
|
||||
Harness a diverse array of nodes from personal computers to specialised
|
||||
hardware---seamlessly integrated into a global node list.
|
||||
|
||||
*** Abstracted Networking Layer
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: abstracted-networking-layer
|
||||
:END:
|
||||
Networking details are completely abstracted, enabling users to focus on
|
||||
developing bespoke task orchestration systems. No more manual
|
||||
configuration of IPs, ports, or connection logic.
|
||||
|
||||
*** Flexible Task Distribution
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: flexible-task-distribution
|
||||
:END:
|
||||
Users acting as clients retain full control over how tasks are batched
|
||||
and assigned to nodes, creating endless possibilities for optimising
|
||||
performance based on specific use cases.
|
||||
|
||||
** Latest tutorial
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: latest-tutorial
|
||||
:END:
|
||||
[[https://www.youtube.com/watch?v=OMwCpedu5cs%22][[[https://i.ytimg.com/vi/OMwCpedu5cs/hqdefault.jpg]]]]
|
||||
|
||||
#+begin_html
|
||||
<!-- ## Table of contents in the current README -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- 1. [Introduction](#Introduction)
|
||||
2. [Installation](#extend-your-application-with-p2prc)
|
||||
3. [Design Architecture](#Design-Architecture)
|
||||
4. [Implementation](#Implementation)
|
||||
5. [Find out more](#Find-out-more) -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- # Table of contents in the Docs folder
|
||||
1. [Introduction](Docs/Introduction.md)
|
||||
2. [Installation](Docs/Installation.md)
|
||||
3. [Abstractions](Docs/Abstractions.md)
|
||||
3. [Design Architecture](DesignArchtectureIntro.md)
|
||||
1. [Client Module](ClientArchitecture.md)
|
||||
2. [P2P Module](P2PArchitecture.md)
|
||||
3. [Server Module](ServerArchitecture.md)
|
||||
4. [Implementation](Docs/Implementation.md)
|
||||
1. [Client Module](Docs/ClientImplementation.md)
|
||||
2. [P2P Module](Docs/P2PImplementation.md)
|
||||
3. [Server Module](Docs/ServerImplementation.md)
|
||||
4. [Config Module](Docs/ConfigImplementation.md)
|
||||
5. [Cli Module](Docs/CliImplementation.md)
|
||||
6. [Plugin Module](Docs/PluginImplementation.md)
|
||||
7. [Language bindings](Docs/Bindings.md)
|
||||
8. [Domain name mappings](Docs/Bindings.md)
|
||||
5. Language bindings
|
||||
1. [Haskell](Docs/haskell/)
|
||||
5. [Problems](https://github.com/Akilan1999/p2p-rendering-computation/issues) -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!--
|
||||
## Introduction
|
||||
This project aims to create a peer to peer (p2p) network, where a user can use the p2p network to act as a client (i.e sending tasks) or the server (i.e executing the tasks). A prototype application will be developed, which comes bundled with a p2p module and possible to execute docker containers or virtual environments across selected nodes.
|
||||
|
||||
### Objectives
|
||||
- Background review on peer to peer network, virtual environments, decentralized rendering tools and tools to batch any sort of tasks.
|
||||
- Creating p2p network
|
||||
- Server to create a containerised environment
|
||||
- The client node to run tasks on Server containerised node -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- [Read more on the introduction](Docs/Introduction.md) -->
|
||||
#+end_html
|
||||
|
||||
#+begin_html
|
||||
<!-- <br> -->
|
||||
#+end_html
|
||||
|
||||
** Extend your application with P2PRC
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: extend-your-application-with-p2prc
|
||||
:END:
|
||||
#+begin_src go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/abstractions"
|
||||
)
|
||||
|
||||
func main() {
|
||||
_, err := abstractions.Init(nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// start p2prc
|
||||
_, err = abstractions.Start()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Run server till termination
|
||||
for {
|
||||
|
||||
}
|
||||
}
|
||||
#+end_src
|
||||
|
||||
#+begin_html
|
||||
<!-- ### Export once this is added export P2PRC as environment paths
|
||||
```
|
||||
export P2PRC=<PROJECT PATH>
|
||||
export PATH=<PROJECT PATH>:${PATH}
|
||||
```
|
||||
[Read more](Docs/Abstractions.md) ...
|
||||
|
||||
## Installation from source
|
||||
1. Ensure the Go compiler is installed
|
||||
```
|
||||
go version
|
||||
```
|
||||
3. Ensure docker is installed (Should run without sudo)
|
||||
```
|
||||
docker ps
|
||||
```
|
||||
3. Clone this repository
|
||||
```
|
||||
git clone https://github.com/Akilan1999/p2p-rendering-computation
|
||||
```
|
||||
4. Install and build the project
|
||||
```
|
||||
make install
|
||||
```
|
||||
- If you look closely you will get outputs such as:
|
||||
```
|
||||
// Add them to your .bashrc file
|
||||
export P2PRC=/<path>/p2p-rendering-computation
|
||||
export PATH=/<path>/p2p-rendering-computation:${PATH}
|
||||
```
|
||||
|
||||
5. Test if it works
|
||||
```
|
||||
p2prc -h
|
||||
```
|
||||
or
|
||||
```
|
||||
./p2prc -h
|
||||
```
|
||||
[Read more on the installation and usage](Docs/Installation.md)
|
||||
|
||||
<br>
|
||||
|
||||
## Design Architecture
|
||||
The design architecture was inspired and based on the linux kernel design. The project is segmented into various modules. Each module is responsible for certain tasks in the project. The modules are highly dependent on each other hence the entire codebase can be considered as a huge monolithic chuck which acts as its own library
|
||||
|
||||
[Read more on the Design Architecture](Docs/DesignArchtectureIntro.md)
|
||||
|
||||
<br>
|
||||
|
||||
## Implementation
|
||||
The programming language used for this project was Golang. The reason Go lang was chosen was because it is a compiled language. The entire codebase is just a single binary file. When distributing to other linux distributing the only requirement would be the binary file to run the code. It is easy to write independant modules and be monolithic at the sametime using Go. Using Go.mod makes it very easy to handle external libraries and modularise code. The go.mod name for the project is git.sr.ht/~akilan1999/p2p-rendering-computation.
|
||||
|
||||
[Read more on the Implementation](Docs/Implementation.md)
|
||||
|
||||
<br> -->
|
||||
#+end_html
|
||||
|
||||
** Find out more
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: find-out-more
|
||||
:END:
|
||||
As we are working on the open source project p2prc (i.e p2p network
|
||||
designed for computation).If you are interested in participating as a
|
||||
contributor or just providing feedback on new features to build or even
|
||||
just curious about new features added to the project do file an Issue or
|
||||
send an email to me@akilan.io.
|
||||
|
||||
[[https://github.com/Gaurav-Gosain][[[https://api.star-history.com/svg?repos=Akilan1999/p2p-rendering-computation&type=Date]]]]
|
||||
@@ -52,8 +52,8 @@ func Start() (*gin.Engine, error) {
|
||||
}
|
||||
|
||||
// MapPort Creates a reverse proxy connection and maps the appropriate port
|
||||
func MapPort(port string, domainName string, serverAddress string) (entireAddress string, mapPort string, err error) {
|
||||
entireAddress, mapPort, err = server.MapPort(port, domainName, serverAddress)
|
||||
func MapPort(port string, domainName string, serverAddress string) (response *client.ResponseMAPPort, err error) {
|
||||
response, err = client.MAPPort(port, domainName, serverAddress)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -3,21 +3,30 @@ package client
|
||||
import (
|
||||
"github.com/Akilan1999/p2p-rendering-computation/config"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type ResponseMAPPort struct {
|
||||
IPAddress string
|
||||
PortNo string
|
||||
EntireAddress string
|
||||
}
|
||||
|
||||
func MAPPort(port string, domainName string) (*ResponseMAPPort, error) {
|
||||
func MAPPort(port string, domainName string, ServerAddress string) (*ResponseMAPPort, error) {
|
||||
Config, err := config.ConfigInit(nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
URL := "http://0.0.0.0:" + Config.ServerPort
|
||||
|
||||
if ServerAddress != "" {
|
||||
URL = "http://" + ServerAddress
|
||||
}
|
||||
|
||||
//if version == "version 6" {
|
||||
URL := "http://0.0.0.0:" + Config.ServerPort + "/MAPPort?port=" + port + "&domain_name=" + domainName
|
||||
URL = URL + "/MAPPort?port=" + port + "&domain_name=" + domainName
|
||||
//} else {
|
||||
// URL = "http://" + IP + ":" + serverPort + "/server_info"
|
||||
//}
|
||||
@@ -32,8 +41,15 @@ func MAPPort(port string, domainName string) (*ResponseMAPPort, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
host, Exposedport, err := net.SplitHostPort(string(byteValue))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var response ResponseMAPPort
|
||||
response.IPAddress = string(byteValue)
|
||||
response.IPAddress = host
|
||||
response.PortNo = Exposedport
|
||||
response.EntireAddress = string(byteValue)
|
||||
|
||||
return &response, nil
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ var CliAction = func(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
if MAPPort != "" {
|
||||
address, err := client.MAPPort(MAPPort, DomainName)
|
||||
address, err := client.MAPPort(MAPPort, DomainName, RemoteAddress)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ var (
|
||||
RemoveContainerGroup bool
|
||||
RemoveGroup string
|
||||
MAPPort string
|
||||
RemoteAddress string
|
||||
DomainName string
|
||||
//FRPProxy bool
|
||||
// Generate only allowed in dev release
|
||||
@@ -43,7 +44,6 @@ var (
|
||||
)
|
||||
|
||||
var AppConfigFlags = []cli.Flag{
|
||||
// Deprecated to be implemented using GRPC
|
||||
&cli.BoolFlag{
|
||||
Name: "Server",
|
||||
Aliases: []string{"s"},
|
||||
@@ -213,6 +213,13 @@ var AppConfigFlags = []cli.Flag{
|
||||
EnvVars: []string{"MAPPORT"},
|
||||
Destination: &MAPPort,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "RemoteAddress",
|
||||
Aliases: []string{"ra"},
|
||||
Usage: "Parameter for Map port for a remote address",
|
||||
EnvVars: []string{"REMOTEADDRESS"},
|
||||
Destination: &RemoteAddress,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "DomainName",
|
||||
Aliases: []string{"dn"},
|
||||
|
||||
40
main.md.org
40
main.md.org
@@ -1,40 +0,0 @@
|
||||
#+begin_html
|
||||
<!-- Code generated by gomarkdoc. DO NOT EDIT -->
|
||||
#+end_html
|
||||
|
||||
* p2p-rendering-computation
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: p2p-rendering-computation
|
||||
:END:
|
||||
#+begin_src go
|
||||
import "github.com/Akilan1999/p2p-rendering-computation"
|
||||
#+end_src
|
||||
|
||||
** Index
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: index
|
||||
:END:
|
||||
- [[#variables][Variables]]
|
||||
|
||||
** Variables
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: variables
|
||||
:END:
|
||||
|
||||
#+begin_src go
|
||||
var List_servers, Ip_table bool
|
||||
#+end_src
|
||||
|
||||
Varaibles if mode is client
|
||||
|
||||
#+begin_src go
|
||||
var OS, Pull_location, Run_script string
|
||||
#+end_src
|
||||
|
||||
VERSION specifies the version of the platform
|
||||
|
||||
#+begin_src go
|
||||
var VERSION = "2.0.0"
|
||||
#+end_src
|
||||
|
||||
Generated by [[https://github.com/princjef/gomarkdoc][gomarkdoc]]
|
||||
@@ -11,9 +11,7 @@ import (
|
||||
"github.com/Akilan1999/p2p-rendering-computation/p2p/frp"
|
||||
"github.com/Akilan1999/p2p-rendering-computation/server/docker"
|
||||
"github.com/gin-gonic/gin"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"os/user"
|
||||
"strconv"
|
||||
@@ -195,7 +193,7 @@ func Server() (*gin.Engine, error) {
|
||||
r.GET("/MAPPort", func(c *gin.Context) {
|
||||
Ports := c.DefaultQuery("port", "0")
|
||||
DomainName := c.DefaultQuery("domain_name", "")
|
||||
url, _, err := MapPort(Ports, DomainName, "")
|
||||
url, _, err := MapPort(Ports, DomainName)
|
||||
if err != nil {
|
||||
c.String(http.StatusInternalServerError, fmt.Sprintf("error: %s", err))
|
||||
}
|
||||
@@ -298,7 +296,7 @@ func Server() (*gin.Engine, error) {
|
||||
ProxyIpAddr.EscapeImplementation = "FRP"
|
||||
|
||||
if config.BareMetal {
|
||||
_, SSHPort, err := MapPort("22", "", "")
|
||||
_, SSHPort, err := MapPort("22", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -375,33 +373,33 @@ func Server() (*gin.Engine, error) {
|
||||
return r, nil
|
||||
}
|
||||
|
||||
func MapPort(port string, domainName string, serverAddress string) (string, string, error) {
|
||||
func MapPort(port string, domainName string) (string, string, error) {
|
||||
|
||||
// if server address is provided to do call RESTAPI to remotely open port.
|
||||
if serverAddress != "" {
|
||||
requestURL := fmt.Sprintf("http://%v/MAPPort?port=%v&domain_name=%v", serverAddress, port, domainName)
|
||||
req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
resBody, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
_, Exposedport, err := net.SplitHostPort(string(resBody))
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
}
|
||||
|
||||
return string(resBody), Exposedport, nil
|
||||
}
|
||||
//if serverAddress != "" {
|
||||
// requestURL := fmt.Sprintf("http://%v/MAPPort?port=%v&domain_name=%v", serverAddress, port, domainName)
|
||||
// req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||
// if err != nil {
|
||||
// return "", "", err
|
||||
// }
|
||||
//
|
||||
// res, err := http.DefaultClient.Do(req)
|
||||
// if err != nil {
|
||||
// return "", "", err
|
||||
// }
|
||||
//
|
||||
// resBody, err := io.ReadAll(res.Body)
|
||||
// if err != nil {
|
||||
// return "", "", err
|
||||
// }
|
||||
//
|
||||
// _, Exposedport, err := net.SplitHostPort(string(resBody))
|
||||
// if err != nil {
|
||||
// return "", "", err
|
||||
// }
|
||||
//
|
||||
// return string(resBody), Exposedport, nil
|
||||
//}
|
||||
|
||||
//Get Server port based on the config file
|
||||
config, err := config.ConfigInit(nil, nil)
|
||||
|
||||
Reference in New Issue
Block a user