Compare commits

..

2 commits

Author SHA1 Message Date
1109fed17e
set IPv6Address type class to struct 2023-12-11 19:25:45 +01:00
42d12eb437
async 2023-12-11 16:55:35 +01:00
6 changed files with 8 additions and 9 deletions

View file

@ -62,8 +62,7 @@ public class Dhcp6Server : IDhcpServer, IDisposable
MacAddress = null MacAddress = null
}; };
await _addrProvider.GetAddress(ctx);
_addrProvider.GetAddress(ctx);
//TODO //TODO
} }

View file

@ -12,9 +12,9 @@ public class DecoupledIPAddressProvider : IAddressProvider<AddressRequestContext
private readonly HttpClient _http; private readonly HttpClient _http;
public IPAddress GetAddress(AddressRequestContext ctx) public async Task<IPAddress> GetAddress(AddressRequestContext ctx)
{ {
_http.GetAsync($"/api/request/{(ctx.IsV6 ? "6" : "4")}/free"); var resp = await _http.GetAsync($"/api/request/{(ctx.IsV6 ? "6" : "4")}/free");
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }

View file

@ -3,7 +3,7 @@ using System.Net.Sockets;
namespace IPMeow.Lib.Address; namespace IPMeow.Lib.Address;
public class IPv6Address public readonly struct IPv6Address
{ {
public IPv6Address(byte[] address) public IPv6Address(byte[] address)
{ {

View file

@ -2,9 +2,9 @@ using System.Net;
namespace IPMeow.Lib.Address; namespace IPMeow.Lib.Address;
public abstract class Network public abstract class Prefix
{ {
public abstract bool IsInNetwork(IPAddress addr); public abstract bool IsInNetwork(IPAddress addr);
public abstract bool IsSubnetOf(Network n); public abstract bool IsSubnetOf(Prefix n);
}; };

View file

@ -4,5 +4,5 @@ namespace IPMeow.Lib.Request;
public interface IAddressProvider<T> where T : AddressRequestContext public interface IAddressProvider<T> where T : AddressRequestContext
{ {
public IPAddress GetAddress(T ctx); public Task<IPAddress> GetAddress(T ctx);
} }

View file

@ -9,5 +9,5 @@ public class Network
[Key] [Key]
public required string Name { get; set; } public required string Name { get; set; }
public virtual ICollection<DnsServer> DnsServers { get; set; } public virtual ICollection<DnsServer> DnsServers { get; set; }
public virtual ICollection<Address.Network> Networks { get; set; } public virtual ICollection<Prefix> Networks { get; set; }
} }