Compare commits
9 Commits
23dea395d3
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d9bfb8896 | |||
| 2b31e112f9 | |||
| f60ea7fd14 | |||
| 2bfd0b686b | |||
| b0dfffff63 | |||
| 64e6bb1343 | |||
| dea308d73d | |||
| 934a053713 | |||
| a955710350 |
@@ -46,6 +46,8 @@ ar = "/usr/bin/x86_64-w64-mingw32-ar"
|
|||||||
linker = "/usr/bin/i686-w64-mingw32-gcc"
|
linker = "/usr/bin/i686-w64-mingw32-gcc"
|
||||||
ar = "/usr/bin/i686-w64-mingw32-ar"
|
ar = "/usr/bin/i686-w64-mingw32-ar"
|
||||||
|
|
||||||
|
[target.aarch64-unknown-linux-gnu]
|
||||||
|
linker = "aarch64-linux-gnu-gcc"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
no-timeout = []
|
no-timeout = []
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
<img src="https://git.pupes.org/PoliEcho/pea_2_pea/raw/branch/master/logo.svg" alt="Pea 2 Pea logo" width="196"></img>
|
||||||
# Pea 2 Pea
|
# Pea 2 Pea
|
||||||
very simple P2P VPN(Virtual Network yes, Private maybe),
|
very simple P2P VPN(Virtual Network yes, Private maybe),
|
||||||
this program is intended to help you play LAN games over internet and as proof of concept
|
this program is intended to help you play LAN games over internet and as proof of concept
|
||||||
@@ -6,10 +7,14 @@ at least for now
|
|||||||
|
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> Piercing NAT may fail based on network configuration
|
> Piercing NAT may fail based on network configuration minor bug fixes
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> windows client does not work thanks to some tappers library issues
|
||||||
|
|
||||||
## how to run
|
## how to run
|
||||||
> install rustc and cargo or rustup, you will need 2024 edition
|
> install rustc and cargo or rustup, you will need 2024 edition
|
||||||
|
> <b><span style='color: red;'>if using windows you need to get</span></b> [wintun](https://www.wintun.net/) <b><span style='color: red;'>driver</span></b>
|
||||||
> build using
|
> build using
|
||||||
> ```bash
|
> ```bash
|
||||||
> # to build
|
> # to build
|
||||||
|
|||||||
@@ -0,0 +1,445 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="484.58453"
|
||||||
|
height="248.42142"
|
||||||
|
viewBox="0 0 128.21298 65.728168"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||||
|
sodipodi:docname="logo.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#999999"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:zoom="1.1099334"
|
||||||
|
inkscape:cx="196.40818"
|
||||||
|
inkscape:cy="60.814458"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1038"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="20"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1" />
|
||||||
|
<defs
|
||||||
|
id="defs1" />
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(3.9106348,-31.359329)">
|
||||||
|
<circle
|
||||||
|
style="fill:#008000;stroke:none;stroke-width:2.91042"
|
||||||
|
id="path1"
|
||||||
|
cx="46.719666"
|
||||||
|
cy="57.45282"
|
||||||
|
r="5" />
|
||||||
|
<circle
|
||||||
|
style="fill:#008000;stroke:none;stroke-width:2.91042"
|
||||||
|
id="path2"
|
||||||
|
cx="83.68927"
|
||||||
|
cy="58.152664"
|
||||||
|
r="5" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="31.945221"
|
||||||
|
y="27.088457"
|
||||||
|
transform="rotate(19.028307)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="29.191198"
|
||||||
|
y="-95.819298"
|
||||||
|
transform="rotate(130.89504)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-6"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="-26.219568"
|
||||||
|
y="-85.876183"
|
||||||
|
transform="rotate(130.89504)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-6-2"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="118.05431"
|
||||||
|
y="23.204641"
|
||||||
|
transform="rotate(22.124773)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-6-5"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="88.477242"
|
||||||
|
y="56.328484"
|
||||||
|
transform="rotate(-9.8371144)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-6-5-9"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="92.291519"
|
||||||
|
y="-31.192705"
|
||||||
|
transform="rotate(63.042937)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-1"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="-35.023296"
|
||||||
|
y="-86.497765"
|
||||||
|
transform="rotate(-171.92112)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#aa4400;stroke:#000000;stroke-width:0.264583;stroke-dasharray:none"
|
||||||
|
id="rect2-3-1-3"
|
||||||
|
width="16.013054"
|
||||||
|
height="7.4165721"
|
||||||
|
x="17.492208"
|
||||||
|
y="-55.955021"
|
||||||
|
transform="rotate(142.51624)" />
|
||||||
|
<g
|
||||||
|
id="g4">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="39.931004"
|
||||||
|
y="105.02441"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.63229"
|
||||||
|
y="100.16535"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.926292"
|
||||||
|
y="95.885963"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-0"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="38.900993"
|
||||||
|
y="91.293457"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g4-6"
|
||||||
|
transform="rotate(65.73685,101.19056,61.333303)">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="39.931004"
|
||||||
|
y="105.02441"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-2"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.63229"
|
||||||
|
y="100.16535"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.926292"
|
||||||
|
y="95.885963"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-0-1"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="38.900993"
|
||||||
|
y="91.293457"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g4-6-6"
|
||||||
|
transform="rotate(-113.69404,61.903716,91.125325)">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="39.931004"
|
||||||
|
y="105.02441"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-2-6"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.63229"
|
||||||
|
y="100.16535"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-9"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="41.926292"
|
||||||
|
y="95.885963"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-0-1-3"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="38.900993"
|
||||||
|
y="91.293457"
|
||||||
|
transform="rotate(-23.434102)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g5">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-8.7603998"
|
||||||
|
y="127.93809"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8-4"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-7.19274"
|
||||||
|
y="122.34638"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8-8"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-9.5258064"
|
||||||
|
y="118.47264"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g5-4"
|
||||||
|
transform="translate(1.5735268,24.969803)">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8-9"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-8.7603998"
|
||||||
|
y="127.93809"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8-4-5"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-7.19274"
|
||||||
|
y="122.34638"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-3-5-5-3-8-8-0"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-9.5258064"
|
||||||
|
y="118.47264"
|
||||||
|
transform="rotate(176.53385,-1.1221414,92.265355)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g6">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="120.58088"
|
||||||
|
y="1.4029152"
|
||||||
|
transform="rotate(17.66615)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-9"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="121.73305"
|
||||||
|
y="4.3680196"
|
||||||
|
transform="rotate(17.66615)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="120.06847"
|
||||||
|
y="10.63729"
|
||||||
|
transform="rotate(17.66615)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-77"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="123.14556"
|
||||||
|
y="7.7831545"
|
||||||
|
transform="rotate(17.66615)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g1">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="104.35145"
|
||||||
|
y="90.858383"
|
||||||
|
transform="rotate(-6.8426428)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-8"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="106.21098"
|
||||||
|
y="87.927322"
|
||||||
|
transform="rotate(-6.8426428)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-9"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="102.55393"
|
||||||
|
y="81.353195"
|
||||||
|
transform="rotate(-6.8426428)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-0"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="107.95219"
|
||||||
|
y="84.665787"
|
||||||
|
transform="rotate(-6.8426428)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g2">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="7.5878925"
|
||||||
|
y="56.102978"
|
||||||
|
transform="rotate(-18.642383)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="4.4349847"
|
||||||
|
y="53.472279"
|
||||||
|
transform="rotate(-18.642383)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-3"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="1.2183968"
|
||||||
|
y="50.885269"
|
||||||
|
transform="rotate(-18.642383)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-0.33573198"
|
||||||
|
y="41.308918"
|
||||||
|
transform="rotate(-18.642383)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112354;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-2"
|
||||||
|
width="7.0014291"
|
||||||
|
height="0.67321438"
|
||||||
|
x="-3.9510856"
|
||||||
|
y="46.704735"
|
||||||
|
transform="rotate(-18.642383)" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="g3">
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="22.438622"
|
||||||
|
y="68.204086"
|
||||||
|
transform="rotate(-11.251809)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5-9"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="21.747293"
|
||||||
|
y="64.102196"
|
||||||
|
transform="rotate(-11.251809)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5-2"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="23.246773"
|
||||||
|
y="60.863266"
|
||||||
|
transform="rotate(-11.251809)" />
|
||||||
|
</g>
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5-2-4"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="97.801979"
|
||||||
|
y="36.583424"
|
||||||
|
transform="rotate(11.279343)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5-2-4-6"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="100.02957"
|
||||||
|
y="39.268402"
|
||||||
|
transform="rotate(13.217335)" />
|
||||||
|
<rect
|
||||||
|
style="fill:#000000;stroke:none;stroke-width:0.112299;stroke-dasharray:none"
|
||||||
|
id="rect4-2-4-06-6-7-5-3-1-6-5-2-4-0"
|
||||||
|
width="6.997993"
|
||||||
|
height="0.67288405"
|
||||||
|
x="99.277161"
|
||||||
|
y="39.332554"
|
||||||
|
transform="rotate(11.279343)" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 14 KiB |
@@ -186,6 +186,17 @@ fn main() -> std::io::Result<()> {
|
|||||||
&iv,
|
&iv,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
let _ = net::send_heartbeat(
|
||||||
|
// send heart beat to start periodic heart beat
|
||||||
|
&mut buf,
|
||||||
|
&server_SocketAddr,
|
||||||
|
socket.clone(),
|
||||||
|
&tmp_v_net,
|
||||||
|
&public_sock_addr,
|
||||||
|
&iv,
|
||||||
|
);
|
||||||
|
|
||||||
tmp_v_net
|
tmp_v_net
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
@@ -727,6 +727,9 @@ pub async fn handle_incoming_connection(
|
|||||||
"[SUCCESS]".green()
|
"[SUCCESS]".green()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
x if x == ServerMethods::HEARTBEAT as u8 => {
|
||||||
|
println!("{} heart beat recive confirmed", "[OK]".green());
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
eprintln!(
|
eprintln!(
|
||||||
"{} unknown method ID: 0x{:02x}, Droping!",
|
"{} unknown method ID: 0x{:02x}, Droping!",
|
||||||
@@ -738,6 +741,7 @@ pub async fn handle_incoming_connection(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn periodic_heart_beat(socket: Arc<UdpSocket>, send_buf: Box<[u8]>, dst: SocketAddr) {
|
pub fn periodic_heart_beat(socket: Arc<UdpSocket>, send_buf: Box<[u8]>, dst: SocketAddr) {
|
||||||
|
println!("{} periodic heartbeat started", "[LOG]".blue());
|
||||||
loop {
|
loop {
|
||||||
std::thread::sleep(std::time::Duration::from_secs(30));
|
std::thread::sleep(std::time::Duration::from_secs(30));
|
||||||
println!("{} sending heartbeat to server", "[LOG]".blue());
|
println!("{} sending heartbeat to server", "[LOG]".blue());
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ pub const SERVER_PORT: u16 = 3543;
|
|||||||
pub const UDP_BUFFER_SIZE: usize = 65527;
|
pub const UDP_BUFFER_SIZE: usize = 65527;
|
||||||
pub const IP_BUFFER_SIZE: usize = 65535;
|
pub const IP_BUFFER_SIZE: usize = 65535;
|
||||||
pub const DEFAULT_TIMEOUT: u64 = 30;
|
pub const DEFAULT_TIMEOUT: u64 = 30;
|
||||||
pub const VERSION: &str = "v1.1";
|
pub const VERSION: &str = "v1.1.1";
|
||||||
pub const BLOCK_SIZE: usize = 16;
|
pub const BLOCK_SIZE: usize = 16;
|
||||||
pub const STANDARD_RETRY_MAX: usize = 10;
|
pub const STANDARD_RETRY_MAX: usize = 10;
|
||||||
|
|
||||||
|
|||||||
+24
-4
@@ -64,7 +64,7 @@ pub async fn handle_request(
|
|||||||
|
|
||||||
let registration = match registration_vector
|
let registration = match registration_vector
|
||||||
.iter()
|
.iter()
|
||||||
.find(|elem| elem.map(|s| &s.net_id == &net_id)) // find if id exists
|
.find(|elem| elem.map(|s| &s.net_id == &net_id && !s.invalid)) // find if id exists
|
||||||
{
|
{
|
||||||
Some(registration) => registration,
|
Some(registration) => registration,
|
||||||
None => {futures::executor::block_on(send_with_count(socket, &src ,&[ServerResponse::ID_DOESNT_EXIST as u8]));
|
None => {futures::executor::block_on(send_with_count(socket, &src ,&[ServerResponse::ID_DOESNT_EXIST as u8]));
|
||||||
@@ -163,7 +163,7 @@ pub async fn handle_request(
|
|||||||
|
|
||||||
match registration_vector
|
match registration_vector
|
||||||
.iter()
|
.iter()
|
||||||
.find(|elem| elem.map(|s| &s.net_id == &net_id)) // find if id exists
|
.find(|elem| elem.map(|s| &s.net_id == &net_id && !s.invalid)) // find if id exists
|
||||||
{
|
{
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
futures::executor::block_on(send_with_count(socket, &src, &[ServerResponse::ID_EXISTS as u8]));
|
futures::executor::block_on(send_with_count(socket, &src, &[ServerResponse::ID_EXISTS as u8]));
|
||||||
@@ -216,7 +216,25 @@ pub async fn handle_request(
|
|||||||
.collect::<String>(),
|
.collect::<String>(),
|
||||||
);
|
);
|
||||||
|
|
||||||
registration_vector.push(types::Registration::new(
|
let mut first_invalid_registration: Option<usize> = None;
|
||||||
|
|
||||||
|
for (i, reg) in registration_vector.iter().enumerate() {
|
||||||
|
if reg.map(|r| r.invalid) {
|
||||||
|
first_invalid_registration = Some(i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match first_invalid_registration {
|
||||||
|
Some(i) => registration_vector[i].update(|r|{*r = types::Registration::new(
|
||||||
|
net_id.clone(),
|
||||||
|
client_sock_addr.clone(),
|
||||||
|
encrypted,
|
||||||
|
chrono::Utc::now().timestamp(),
|
||||||
|
salt,
|
||||||
|
iv,
|
||||||
|
src
|
||||||
|
);}),
|
||||||
|
None => {registration_vector.push(types::Registration::new(
|
||||||
net_id,
|
net_id,
|
||||||
client_sock_addr,
|
client_sock_addr,
|
||||||
encrypted,
|
encrypted,
|
||||||
@@ -224,7 +242,9 @@ pub async fn handle_request(
|
|||||||
salt,
|
salt,
|
||||||
iv,
|
iv,
|
||||||
src
|
src
|
||||||
));
|
));},
|
||||||
|
};
|
||||||
|
|
||||||
send_with_count(socket, &src, &[ServerMethods::REGISTER as u8]).await;
|
send_with_count(socket, &src, &[ServerMethods::REGISTER as u8]).await;
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
println!("network registered");
|
println!("network registered");
|
||||||
|
|||||||
Reference in New Issue
Block a user