vforteli / Flexinets.Radius.RadiusServer

Radius server for .Net. Packets handled in pluggable IPacketHandlers
MIT License
45 stars 22 forks source link

Add Handlers Obsolete? What is the alternative #12

Closed ByronAP closed 4 years ago

ByronAP commented 4 years ago

https://github.com/vforteli/Flexinets.Radius.RadiusServer/blob/7b8ed15923a85b87ba2c1e0b47d66a8541f1b64b/RadiusServer/IPacketHandlerRepository.cs#L11-L16

What is the recommended way to add handlers if this way is obsolete?

vforteli commented 4 years ago

Hey,

Its only slightly changed, to this:

  var repository = new PacketHandlerRepository();
                repository.AddPacketHandler(IPAddress.Any, packetHandler, "secret");

                _authenticationServer = new RadiusServer(
                    udpClientFactory,
                    new IPEndPoint(IPAddress.Any, 1812),
                    radiusPacketParser,
                    RadiusServerType.Authentication,
                    repository,
                    NullLogger<RadiusServer>.Instance);

So instead you create the PacketHandlerRepository and pass that to the server. It is more verbose, but rationale behind this change was that in some cases you may want to do more complex logic for deciding which package handler to use

ByronAP commented 4 years ago

I don't think I fully understand. Are you saying that it is marked obsolete to help people know not to directly use the interface but instead use the implementation of PacketHandlerRepository?

ByronAP commented 4 years ago

closing just because it is not a real issue, although some code comments would be helpful :-)