import { GlobeLock, RouteOff } from 'lucide-react'; import { useFetcher } from 'react-router'; import Dialog from '~/components/Dialog'; import Link from '~/components/Link'; import Switch from '~/components/Switch'; import TableList from '~/components/TableList'; import { PopulatedNode } from '~/utils/node-info'; interface RoutesProps { node: PopulatedNode; isOpen: boolean; setIsOpen: (isOpen: boolean) => void; } // TODO: Support deleting routes export default function Routes({ node, isOpen, setIsOpen }: RoutesProps) { const fetcher = useFetcher(); const subnets = [ ...node.customRouting.subnetApprovedRoutes, ...node.customRouting.subnetWaitingRoutes, ]; return ( Edit route settings of {node.givenName} Subnet routes Connect to devices you can't install Tailscale on by advertising IP ranges as subnet routes.{' '} Learn More {subnets.length === 0 ? (

No routes are advertised by this machine

) : undefined} {subnets.map((route) => (

{route.prefix}

{ const form = new FormData(); form.set('action_id', 'update_routes'); form.set('node_id', node.id); form.set('routes', [route.id].join(',')); form.set('enabled', String(checked)); fetcher.submit(form, { method: 'POST', }); }} />
))}
Exit nodes Allow your network to route internet traffic through this machine.{' '} Learn More {node.customRouting.exitRoutes.length === 0 ? (

This machine is not an exit node

) : (

Use as exit node

{ const form = new FormData(); form.set('action_id', 'update_routes'); form.set('node_id', node.id); form.set( 'routes', node.customRouting.exitRoutes .map((route) => route.id) .join(','), ); form.set('enabled', String(checked)); fetcher.submit(form, { method: 'POST', }); }} />
)}
); }