You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typical server: construct SocketDescriptor (types.h:139), call Startup, check it == RAKNET_STARTED (types.h:38), then SetMaximumIncomingConnections.
Security is optional on master — InitializeSecurity(publicKey, privateKey, bRequireClientKey) (peerinterface.h:80, gated behind LIBCAT_SECURITY) and DisableSecurity() (:84). Connect() takes an optional PublicKey* (types.h:123, default 0 = insecure). This issue does not change the security model — it just offers a tidy place to wire those calls.
Goal
A fluent builder over Peer:
auto server = Peer::server()
.port(60000)
.max_connections(32)
.incoming_password("hunter2") // optional -> SetIncomingPassword
.start(); // -> Startup + SetMaximumIncomingConnectionsauto client = Peer::client()
.max_connections(1)
.connect("127.0.0.1", 60000) // -> Startup then Connect
.start();
start() returns Result<Peer> (or throws — decide in review) carrying the StartupResult / ConnectionAttemptResult on failure.
Where
Add Peer::server() / Peer::client() builder types in Source/include/mafianet/Peer.h (with #16).
Notes
Builder owns the SocketDescriptor until start(), so the caller never manages the array/count.
Optional .secure(publicKey, privateKey) may call InitializeSecurity before Startup — keep it opt-in, mirroring master. Do not imply encryption is mandatory.
Surface the failure enum clearly; don't collapse it to a bool.
Acceptance criteria
Peer::server().port(p).max_connections(n).start() replaces the manual 3-call sequence.
Failure path exposes the underlying StartupResult / ConnectionAttemptResult.
Context
Startup is a multi-call dance. From
peerinterface.h:Typical server: construct
SocketDescriptor(types.h:139), callStartup, check it== RAKNET_STARTED(types.h:38), thenSetMaximumIncomingConnections.Security is optional on
master—InitializeSecurity(publicKey, privateKey, bRequireClientKey)(peerinterface.h:80, gated behindLIBCAT_SECURITY) andDisableSecurity()(:84).Connect()takes an optionalPublicKey*(types.h:123, default0= insecure). This issue does not change the security model — it just offers a tidy place to wire those calls.Goal
A fluent builder over
Peer:start()returnsResult<Peer>(or throws — decide in review) carrying theStartupResult/ConnectionAttemptResulton failure.Where
Add
Peer::server()/Peer::client()builder types inSource/include/mafianet/Peer.h(with #16).Notes
SocketDescriptoruntilstart(), so the caller never manages the array/count..reliability_defaults(...)etc. using the scoped enums from [DX L0] Scoped-enum façade for Reliability & Priority #13 if useful..secure(publicKey, privateKey)may callInitializeSecuritybeforeStartup— keep it opt-in, mirroringmaster. Do not imply encryption is mandatory.Acceptance criteria
Peer::server().port(p).max_connections(n).start()replaces the manual 3-call sequence.StartupResult/ConnectionAttemptResult.Dependencies
PeerandPacketPtr(keystone) #16 (returnsPeer); Layer 0 scoped enums ([DX L0] Scoped-enum façade for Reliability & Priority #13).