1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-08-30 04:53:10 +02:00
Files
.config
.run
.workdir
Agent
Common
Controller
Docker
Utils
Phantom.Utils
Phantom.Utils.Actor
Phantom.Utils.Events
Phantom.Utils.Logging
Phantom.Utils.Rpc
Message
Runtime
Sockets
RpcClientSocket.cs
RpcServerSocket.cs
RpcSocket.cs
Phantom.Utils.Rpc.csproj
RpcConfiguration.cs
RpcExtensions.cs
Phantom.Utils.Tests
Web
.dockerignore
.gitattributes
.gitignore
AddMigration.bat
AddMigration.sh
Directory.Build.props
Directory.Build.targets
Dockerfile
LICENSE
Packages.props
PhantomPanel.sln
README.md
global.json
Minecraft-Phantom-Panel/Utils/Phantom.Utils.Rpc/Sockets/RpcServerSocket.cs

27 lines
846 B
C#

using NetMQ.Sockets;
using Phantom.Utils.Logging;
namespace Phantom.Utils.Rpc.Sockets;
sealed class RpcServerSocket : RpcSocket<ServerSocket> {
public static RpcServerSocket Connect(RpcConfiguration config) {
var socket = new ServerSocket();
var options = socket.Options;
options.CurveServer = true;
options.CurveCertificate = config.ServerCertificate;
RpcSocket.SetDefaultSocketOptions(options);
var url = config.TcpUrl;
var logger = PhantomLogger.Create(config.LoggerName);
logger.Information("Starting ZeroMQ server on {Url}...", url);
socket.Bind(url);
logger.Information("ZeroMQ server initialized, listening for connections on port {Port}.", config.Port);
return new RpcServerSocket(socket, config);
}
private RpcServerSocket(ServerSocket socket, RpcConfiguration config) : base(socket, config) {}
}