Refactor billing configuration management to centralize expiration handling
- Updated `BillingConfigResumer` to manage billing expiration entirely on the application side, using `enable` as the sole control mechanism for client access. - Changed all relevant methods to pass `DateTimeOffset.UnixEpoch` for `expiresAt`, ensuring the panel does not enforce expiration independently of our application logic. - Modified `IXuiPanelGateway` interface to reflect the new expiration handling approach, clarifying the role of `expiresAt` in client management. - Adjusted command handlers for creating and rotating VPN configurations to set `expiresAt` to `null`, preventing unintended expiration enforcement by the panel. - Enhanced documentation to explain the new billing expiration management strategy and its implications for client configurations.
This commit is contained in:
+14
@@ -144,6 +144,20 @@ public class ApproveExtensionRequestCommandHandlerTests
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.Equal(ConfigStatus.Active, config.Status);
|
||||
Assert.NotNull(config.ExpiresAt);
|
||||
// enable:true — истечение управляется полностью на нашей стороне, панельный expiresAt
|
||||
// сбрасывается в "без срока" (см. BillingConfigResumer.NoExpiry), а не в реальный новый срок.
|
||||
await _gateway
|
||||
.Received(1)
|
||||
.UpdateClientAsync(
|
||||
Arg.Any<Node>(),
|
||||
inbound.RemoteInboundId,
|
||||
"ext-1",
|
||||
VpnProtocol.Vless,
|
||||
Arg.Any<string>(),
|
||||
true,
|
||||
Arg.Is<DateTimeOffset?>(d => d == DateTimeOffset.UnixEpoch),
|
||||
Arg.Any<CancellationToken>()
|
||||
);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user