feat(external-gateway): add gateway client domain and DNS record support for dcrouter integration
This commit is contained in:
@@ -36,6 +36,8 @@ export interface INetworkState {
|
||||
trafficStats: interfaces.data.ITrafficStats | null;
|
||||
dnsRecords: interfaces.data.IDnsRecord[];
|
||||
domains: interfaces.data.IDomainDetail[];
|
||||
gatewayDomains: interfaces.data.IGatewayDomain[];
|
||||
gatewayDnsRecords: interfaces.data.IGatewayDnsRecord[];
|
||||
certificates: interfaces.data.ICertificate[];
|
||||
}
|
||||
|
||||
@@ -110,6 +112,8 @@ export const networkStatePart = await appState.getStatePart<INetworkState>(
|
||||
trafficStats: null,
|
||||
dnsRecords: [],
|
||||
domains: [],
|
||||
gatewayDomains: [],
|
||||
gatewayDnsRecords: [],
|
||||
certificates: [],
|
||||
},
|
||||
'soft',
|
||||
@@ -628,6 +632,34 @@ export const fetchDomainsAction = networkStatePart.createAction(async (statePart
|
||||
}
|
||||
});
|
||||
|
||||
export const fetchGatewayDomainsAction = networkStatePart.createAction(async (statePartArg) => {
|
||||
const context = getActionContext();
|
||||
try {
|
||||
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_GetGatewayDomains
|
||||
>('/typedrequest', 'getGatewayDomains');
|
||||
const response = await typedRequest.fire({ identity: context.identity! });
|
||||
return { ...statePartArg.getState(), gatewayDomains: response.domains };
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch gateway domains:', err);
|
||||
return statePartArg.getState();
|
||||
}
|
||||
});
|
||||
|
||||
export const fetchGatewayDnsRecordsAction = networkStatePart.createAction(async (statePartArg) => {
|
||||
const context = getActionContext();
|
||||
try {
|
||||
const typedRequest = new plugins.domtools.plugins.typedrequest.TypedRequest<
|
||||
interfaces.requests.IReq_GetGatewayDnsRecords
|
||||
>('/typedrequest', 'getGatewayDnsRecords');
|
||||
const response = await typedRequest.fire({ identity: context.identity! });
|
||||
return { ...statePartArg.getState(), gatewayDnsRecords: response.records };
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch gateway DNS records:', err);
|
||||
return statePartArg.getState();
|
||||
}
|
||||
});
|
||||
|
||||
export const fetchCertificatesAction = networkStatePart.createAction(async (statePartArg) => {
|
||||
const context = getActionContext();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user