async
This commit is contained in:
parent
6c5e9b8716
commit
42d12eb437
5 changed files with 7 additions and 8 deletions
|
@ -62,8 +62,7 @@ public class Dhcp6Server : IDhcpServer, IDisposable
|
||||||
MacAddress = null
|
MacAddress = null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await _addrProvider.GetAddress(ctx);
|
||||||
_addrProvider.GetAddress(ctx);
|
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
};
|
};
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue