import { isLoopbackAddr } from 'is-loopback-addr';
import { getNetConfig } from "./get-net-config.js";
/**
 * Check if a given multiaddr is a loopback address.
 */
export function isLoopback(ma) {
    try {
        const config = getNetConfig(ma);
        switch (config.type) {
            case 'ip4':
            case 'ip6':
                return isLoopbackAddr(config.host);
            default:
                return false;
        }
    }
    catch {
        return false;
    }
}
//# sourceMappingURL=is-loopback.js.map