import { FaultTolerance, InvalidParametersError } from '@libp2p/interface';
import { mergeOptions } from '@libp2p/utils/merge-options';
import { dnsaddrResolver } from "./connection-manager/resolvers/dnsaddr.js";
const DefaultConfig = {
    addresses: {
        listen: [],
        announce: [],
        noAnnounce: [],
        announceFilter: (multiaddrs) => multiaddrs
    },
    connectionManager: {
        resolvers: {
            dnsaddr: dnsaddrResolver
        }
    },
    transportManager: {
        faultTolerance: FaultTolerance.FATAL_ALL
    }
};
export async function validateConfig(opts) {
    const resultingOptions = mergeOptions(DefaultConfig, opts);
    if (resultingOptions.connectionProtector === null && globalThis.process?.env?.LIBP2P_FORCE_PNET != null) {
        throw new InvalidParametersError('Private network is enforced, but no protector was provided');
    }
    return resultingOptions;
}
//# sourceMappingURL=config.js.map