2023-09-15 10:36:35 +00:00
|
|
|
|
namespace GethPlugin
|
|
|
|
|
{
|
2023-09-15 13:52:02 +00:00
|
|
|
|
public interface IGethSetup
|
2023-09-15 10:36:35 +00:00
|
|
|
|
{
|
2023-09-15 13:52:02 +00:00
|
|
|
|
IGethSetup IsMiner();
|
2023-11-21 09:33:11 +00:00
|
|
|
|
IGethSetup WithBootstrapNode(IGethNode node);
|
2023-09-15 13:52:02 +00:00
|
|
|
|
IGethSetup WithBootstrapNode(GethBootstrapNode node);
|
|
|
|
|
IGethSetup WithName(string name);
|
2023-10-23 11:19:57 +00:00
|
|
|
|
IGethSetup AsPublicTestNet(GethTestNetConfig gethTestNetConfig);
|
2023-09-15 13:52:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class GethStartupConfig : IGethSetup
|
|
|
|
|
{
|
|
|
|
|
public bool IsMiner { get; private set; }
|
|
|
|
|
public GethBootstrapNode? BootstrapNode { get; private set; }
|
|
|
|
|
public string? NameOverride { get; private set; }
|
2023-10-23 11:19:57 +00:00
|
|
|
|
public GethTestNetConfig? IsPublicTestNet { get; private set; }
|
2023-09-15 13:52:02 +00:00
|
|
|
|
|
2023-11-21 09:33:11 +00:00
|
|
|
|
public IGethSetup WithBootstrapNode(IGethNode node)
|
|
|
|
|
{
|
|
|
|
|
return WithBootstrapNode(node.GetBootstrapRecord());
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-15 13:52:02 +00:00
|
|
|
|
public IGethSetup WithBootstrapNode(GethBootstrapNode node)
|
|
|
|
|
{
|
|
|
|
|
BootstrapNode = node;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IGethSetup WithName(string name)
|
|
|
|
|
{
|
|
|
|
|
NameOverride = name;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IGethSetup IGethSetup.IsMiner()
|
|
|
|
|
{
|
|
|
|
|
IsMiner = true;
|
|
|
|
|
return this;
|
|
|
|
|
}
|
2023-10-23 09:23:44 +00:00
|
|
|
|
|
2023-10-23 11:19:57 +00:00
|
|
|
|
public IGethSetup AsPublicTestNet(GethTestNetConfig gethTestNetConfig)
|
2023-10-23 09:23:44 +00:00
|
|
|
|
{
|
2023-10-23 11:19:57 +00:00
|
|
|
|
IsPublicTestNet = gethTestNetConfig;
|
2023-10-23 09:23:44 +00:00
|
|
|
|
return this;
|
|
|
|
|
}
|
2023-09-15 13:52:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-23 11:19:57 +00:00
|
|
|
|
public class GethTestNetConfig
|
|
|
|
|
{
|
2023-11-15 13:53:25 +00:00
|
|
|
|
public GethTestNetConfig(int discoveryPort, int listenPort)
|
2023-10-23 11:19:57 +00:00
|
|
|
|
{
|
|
|
|
|
DiscoveryPort = discoveryPort;
|
2023-10-27 06:33:07 +00:00
|
|
|
|
ListenPort = listenPort;
|
2023-10-23 11:19:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int DiscoveryPort { get; }
|
2023-10-27 06:33:07 +00:00
|
|
|
|
public int ListenPort { get; }
|
2023-10-23 11:19:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-15 13:52:02 +00:00
|
|
|
|
public class GethBootstrapNode
|
|
|
|
|
{
|
|
|
|
|
public GethBootstrapNode(string publicKey, string ipAddress, int port)
|
2023-09-15 10:36:35 +00:00
|
|
|
|
{
|
2023-09-15 13:52:02 +00:00
|
|
|
|
PublicKey = publicKey;
|
|
|
|
|
IpAddress = ipAddress;
|
|
|
|
|
Port = port;
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-15 13:52:02 +00:00
|
|
|
|
public string PublicKey { get; }
|
|
|
|
|
public string IpAddress { get; }
|
|
|
|
|
public int Port { get; }
|
2023-09-15 10:36:35 +00:00
|
|
|
|
}
|
|
|
|
|
}
|