DataHoarder
55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
132 lines
9.4 KiB
Plaintext
132 lines
9.4 KiB
Plaintext
{% import "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/index" %}
|
|
{% import "git.gammaspectra.live/P2Pool/p2pool-observer/p2pool/sidechain" %}
|
|
{% import p2pooltypes "git.gammaspectra.live/P2Pool/p2pool-observer/p2pool/types" %}
|
|
{% import "net/netip" %}
|
|
|
|
{% code
|
|
type ConnectivityCheckPage struct {
|
|
// inherit from base page, so its' title is used in error page.
|
|
BasePage
|
|
|
|
Address netip.AddrPort
|
|
YourTip *index.SideBlock
|
|
YourTipRaw *sidechain.PoolBlock
|
|
OurTip *index.SideBlock
|
|
Check *p2pooltypes.P2PoolConnectionCheckInformation[*sidechain.PoolBlock]
|
|
}
|
|
|
|
func (p *ConnectivityCheckPage) Name() string {
|
|
return "connectivity-check"
|
|
}
|
|
%}
|
|
|
|
{% func (p *ConnectivityCheckPage) Title() %}
|
|
{%= p.BasePage.Title() %} - Connectivity Check
|
|
{% endfunc %}
|
|
|
|
{% func (p *ConnectivityCheckPage) Content() %}
|
|
<div style="text-align: center">
|
|
<form action="/connectivity-check" method="get">
|
|
<h2>Connectivity Check</h2>
|
|
<p>
|
|
This tool tries to connect or looks up a running P2Pool node to verify ports have been properly opened.
|
|
<br/>
|
|
<small>You need to have external ports opened for this tool to work.</small>
|
|
</p>
|
|
<div>
|
|
<label for="address">IP Address and Port</label><br/>
|
|
<input type="text" name="address" id="address" placeholder="5.9.17.234:{%dul uint64(p.Context().Consensus.DefaultPort()) %}" size="20" class="mono" value="{% if p.Address.IsValid() %}{%s p.Address.String() %}{% endif %}"/>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<input type="submit" value="Check" style="width: 20em;"/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
|
|
{% if p.Address.IsValid() %}
|
|
<hr/>
|
|
<div style="text-align: center">
|
|
<h2>Connectivity Check Result</h2>
|
|
{% if p.Check == nil %}
|
|
<p style="color:#FF4433">Could not connect to host.</p>
|
|
{% elseif p.Check.Error != "" && p.Check.Address == "" %}
|
|
<p style="color:#FF4433">Error connecting to host: <code>{%s p.Check.Error %}</code>.</p>
|
|
{% if p.Check.Error == "disconnected before finishing handshake" %}
|
|
<p>This peer is likely running on a different SideChain or is running an incompatible P2Pool software version. Try a different Observer or verify your software.</p>
|
|
{% elseif p.Check.Error == "not_valid_ip" %}
|
|
<p>The IP Address you are trying to connect to is not valid or accepted on this tool.</p>
|
|
{% elseif p.Check.Error == "not_valid_port" %}
|
|
<p>The Port you are trying to connect to is not valid or accepted on this tool.</p>
|
|
{% endif %}
|
|
{% else %}
|
|
<table class="center" style="max-width: calc(8em + 28em + 8em + 28em + 20em)">
|
|
<tr style="line-height: 1.5;">
|
|
<td style="width: 10em"><strong>Peer Address</strong><br/>{%s p.Check.Address %}</td>
|
|
<td style="width: 10em"><strong>Peer Port</strong><br/>{%dul uint64(p.Check.Port) %}</td>
|
|
<td style="width: 10em"><strong>Listen Port</strong><br/>{% if p.Check.ListenPort > 0 %}{%dul uint64(p.Check.ListenPort) %}{% else %}-{% endif %}</td>
|
|
<td style="width: 10em"><strong>Peer Id</strong><br/>{% if p.Check.PeerId > 0 %}{%dul p.Check.PeerId %}{% else %}-{% endif %}</td>
|
|
<td style="width: 10em"><strong>Connection Direction</strong><br/>{% if p.Check.Incoming %}Incoming{% else %}Outgoing{% endif %}</td>
|
|
<td style="width: 10em"><strong>Connection Status</strong><br/>{% if p.Check.Closed %}Closed{% else %}Active{% endif %}{% if !p.Check.AlreadyConnected %}, new connection{% endif %}{% if p.Check.Banned %} (banned){% endif %}</td>
|
|
</tr>
|
|
{% if !p.Check.Closed || p.Check.PeerId > 0 %}
|
|
<tr style="line-height: 1.5;">
|
|
<td style="width: 10em"><strong>Peer Software</strong><br/>{%s p.Check.SoftwareId %} {%s p.Check.SoftwareVersion %}</td>
|
|
<td style="width: 10em"><strong>Peer Protocol</strong><br/>{%s p.Check.ProtocolVersion %}</td>
|
|
<td style="width: 10em"><strong>Handshake Complete</strong><br/>{% if p.Check.HandshakeComplete %}Yes{% else %}No{% endif %}</td>
|
|
<td style="width: 10em"><strong>Last Broadcast</strong><br/><span title="{%s utc_date(p.Check.BroadcastTime) %}">{%s time_elapsed_short(p.Check.BroadcastTime) %}</span></td>
|
|
<td style="width: 10em"><strong>Connection Duration</strong><br/><span title="{%s utc_date(p.Check.ConnectionTime) %}">{%s time_elapsed_short(p.Check.ConnectionTime) %}</span></td>
|
|
<td style="width: 10em"><strong>Connection Latency</strong><br/>{% if p.Check.Latency > 0 %}{%dul p.Check.Latency %}ms{% else %}-{% endif %}</td>
|
|
</tr>
|
|
{% endif %}
|
|
{% if p.Check.BanError != "" %}
|
|
<tr><th colspan="6"> </th></tr>
|
|
<tr><td colspan="6" style="color:#FF4433"><strong>Previous Ban Error:</strong> <code>{%s p.Check.BanError %}</code></td></tr>
|
|
{% endif %}
|
|
{% if p.Check.Error != "" %}
|
|
<tr><th colspan="6"> </th></tr>
|
|
<tr><td colspan="6" style="color:#FF4433"><strong>Error:</strong> <code>{%s p.Check.Error %}</code></td></tr>
|
|
{% if p.Check.Error == "disconnected before finishing handshake" %}
|
|
<tr><td colspan="6">This peer is likely running on a different SideChain or is running an incompatible P2Pool software version. Try a different Observer or verify your software.<br/>Alternatively this peer could have banned the Observer node and we cannot connect properly.</td></tr>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if p.Check.Tip != nil %}
|
|
<tr><th colspan="6"> </th></tr>
|
|
<tr style="line-height: 1.5;">
|
|
<td style="width: 10em"><strong>Peer SideChain Height</strong><br/><a href="/share/{%= hex(p.Context(), p.YourTipRaw.SideTemplateId(p.Context().Consensus)) %}">{%dul p.YourTipRaw.Side.Height %}</a></td>
|
|
<td style="width: 10em"><strong>Peer SideChain Id</strong><br/><a href="/share/{%= hex(p.Context(), p.YourTipRaw.SideTemplateId(p.Context().Consensus)) %}" title="{%= hex(p.Context(), p.YourTipRaw.SideTemplateId(p.Context().Consensus)) %}">{%= shorten(p.Context(), p.YourTipRaw.SideTemplateId(p.Context().Consensus), 10) %}</a></td>
|
|
<td style="width: 10em"><strong>Peer MainChain Height</strong><br/>{%dul p.YourTipRaw.Main.Coinbase.GenHeight %}</td>
|
|
<td style="width: 10em"><strong>Peer Difficulty</strong><br/>{%s si_units(p.YourTipRaw.Side.Difficulty.Lo, 4) %}</td>
|
|
<td style="width: 10em"><strong>Peer Cumulative Difficulty</strong><br/>{%s si_units(p.YourTipRaw.Side.CumulativeDifficulty.Lo, 4) %}</td>
|
|
<td style="width: 10em"><strong>Peer Timestamp</strong><br/>{%s utc_date(p.YourTipRaw.Main.Timestamp) %}</td>
|
|
</tr>
|
|
<tr style="line-height: 1.5;">
|
|
<td style="width: 10em"><strong>Observer SideChain Height</strong><br/><a href="/share/{%= hex(p.Context(), p.OurTip.TemplateId) %}">{%dul p.OurTip.SideHeight %}</a></td>
|
|
<td style="width: 10em"><strong>Observer SideChain Id</strong><br/><a href="/share/{%= hex(p.Context(), p.OurTip.TemplateId) %}" title="{%= hex(p.Context(), p.OurTip.TemplateId) %}">{%= shorten(p.Context(), p.OurTip.TemplateId, 10) %}</a></td>
|
|
<td style="width: 10em"><strong>Observer MainChain Height</strong><br/>{%dul p.OurTip.MainHeight %}</td>
|
|
<td style="width: 10em"><strong>Observer Difficulty</strong><br/>{%s si_units(p.OurTip.Difficulty, 4) %}</td>
|
|
<td style="width: 10em"><strong>Observer Cumulative Difficulty</strong><br/>{%s si_units(p.OurTip.CumulativeDifficulty.Lo, 4) %}</td>
|
|
<td style="width: 10em"><strong>Observer Timestamp</strong><br/>{%s utc_date(p.OurTip.Timestamp) %}</td>
|
|
</tr>
|
|
<tr><th colspan="6"> </th></tr>
|
|
{% if ((p.YourTipRaw.Main.Coinbase.GenHeight < (p.OurTip.MainHeight-3)) || (p.YourTipRaw.Main.Coinbase.GenHeight > (p.OurTip.MainHeight+3))) %}
|
|
<tr><td colspan="6" style="font-weight: bold; color:#FF4433">Peer Monero node is on a wildly different Monero height than Observer.<br/>Either peer node is lagging behind or your monerod is not up to sync.</td></tr>
|
|
{% endif %}
|
|
{% if p.YourTip == nil && ((p.YourTipRaw.Side.Height < (p.OurTip.SideHeight-3)) || (p.YourTipRaw.Side.Height > (p.OurTip.SideHeight+3))) %}
|
|
<tr><td colspan="6" style="font-weight: bold; color:#FF4433">Could not find Peer SideChain Tip on Observer.<br/>Either peer node is lagging behind or you are on a forked SideChain.</td></tr>
|
|
{% elseif (p.YourTipRaw.Side.Height < (p.OurTip.SideHeight-3)) || (p.YourTipRaw.Side.Height > (p.OurTip.SideHeight+3)) %}
|
|
<tr><td colspan="6" style="font-weight: bold">The peer is connectable and on the SideChain.<br/>Peer SideChain Tip is on a wildly different SideChain height than Observer.<br/>Either peer node is lagging behind or your p2pool is not up to sync.</td></tr>
|
|
{% else %}
|
|
<tr><td colspan="6" style="font-weight: bold">The peer is connectable and on the SideChain.<br/>{% if p.OurTip.TemplateId == p.YourTipRaw.SideTemplateId(p.Context().Consensus) %}The peer Tip matches exactly the Observer Tip.{% else %}Verify Peer SideChain Height against Observer SideChain Height, so it's not consistently different.{% endif %}</td></tr>
|
|
{% endif %}
|
|
<tr><th colspan="6"> </th></tr>
|
|
<tr><td colspan="6">
|
|
{%= TemplatePoolBlock(p.Context(), p.YourTipRaw, "Peer Tip Share information") %}
|
|
</td></tr>
|
|
{% endif %}
|
|
{% endif %}
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
{% endfunc %} |