import { Info } from "lucide-react"; import { Form, useSubmit } from "react-router"; import Button from "~/components/Button"; import Link from "~/components/link"; import Switch from "~/components/Switch"; import TableList from "~/components/TableList"; import Tooltip from "~/components/Tooltip"; import cn from "~/utils/cn"; import AddNS from "../dialogs/add-ns"; interface Props { nameservers: Record; overrideLocalDns: boolean; isDisabled: boolean; } export default function ManageNS({ nameservers, isDisabled, overrideLocalDns }: Props) { return (

Nameservers

Set the nameservers used by devices on the Tailnet to resolve DNS queries.{" "} Learn more

{Object.keys(nameservers).map((key) => ( ))} {isDisabled ? undefined : }
); } interface ListProps { isGlobal: boolean; isDisabled: boolean; nameservers: Record; overrideLocalDns: boolean; name: string; } function NameserverList({ isGlobal, isDisabled, nameservers, overrideLocalDns, name }: ListProps) { const list = isGlobal ? nameservers.global : nameservers[name]; const submit = useSubmit(); if (list.length === 0) { return null; } return (
{isGlobal ? (

Global Nameservers

When enabled, use the DNS servers listed below to resolve names outside the tailnet. When disabled (default), devices will prefer their local DNS configuration. Learn More

Override DNS servers

{ submit( { action_id: "override_dns", override_dns: v ? "true" : "false", }, { method: "POST", }, ); }} switchClassName="h-[9px] w-[9px]" />
) : (

{name}

)}
{list.length > 0 ? list.map((ns) => (

{ns}

)) : undefined}
); }