Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 968 Bytes

File metadata and controls

23 lines (16 loc) · 968 Bytes

RustPlusApi.Extensions.DependencyInjection

Microsoft.Extensions.DependencyInjection registration extensions for RustPlusApi.

// one configured client (singleton, container-disposed)
services.AddRustPlus(new RustPlusConnection("12.34.56.78", 28082, playerId, playerToken));

// or bound from configuration (keys: Server, Port, PlayerId, PlayerToken, UseFacepunchProxy)
services.AddRustPlus(configuration.GetSection("Rust"));

// many / runtime connections: caller-owned clients via the factory
services.AddRustPlusFactory();
await using var client = provider.GetRequiredService<IRustPlusFactory>().Create(connection);

Logging auto-wires from the host's ILoggerFactory; tuning via IOptions<RustPlusSocketOptions>. Nothing auto-connects — call ConnectAsync when ready.

Documentation