diff --git a/src/app.tsx b/src/app.tsx index 3396e2e..713b9e9 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import React, { ReactComponentElement, ReactNode } from 'react'; -import { TailscaleBackendState, TailscaleStatus, TailscaleUp } from './types'; +import { TailscaleBackendState, TailscalePeer, TailscaleStatus, TailscaleUp } from './types'; import { Card, CardTitle, CardBody } from '@patternfly/react-core'; type ApplicationProps = { @@ -26,19 +26,39 @@ export class Application extends React.Component Tailscale -
                 {
                     this.state.Status != null
-                        ? this.state.Status.Self.HostName + " " + this.state.Status.Self.TailscaleIPs[0]
+                        ? <>
+                            
+                            
+ { + Object.entries(this.state.Status.Peer).map(peer => + { + return + } + ) + } + :

Loading...

} -
); } } + + +class Peer extends React.Component { + render() { + return (
+

+

{ this.props.TailscaleIPs[0] } { ' '.repeat(15 - this.props.TailscaleIPs[0].length) } { this.props.HostName }
+

+
); + } +} diff --git a/src/types.ts b/src/types.ts index 9d0a83b..57f4ba7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,13 +1,13 @@ // BackendState // Keep in sync with https://github.com/tailscale/tailscale/blob/main/ipn/backend.go export type TailscaleBackendState = - | 'NoState' - | 'NeedsMachineAuth' - | 'NeedsLogin' - | 'InUseOtherUser' - | 'Stopped' - | 'Starting' - | 'Running'; + | 'NoState' + | 'NeedsMachineAuth' + | 'NeedsLogin' + | 'InUseOtherUser' + | 'Stopped' + | 'Starting' + | 'Running'; export enum OS { Android = "android", @@ -26,42 +26,51 @@ export type TailscalePeer = { UserID: string; TailscaleIPs: string[] Tags?: string[]; - Online: boolean; Capabilities?: string[]; + Relay: string; + RxBytes: number; + TxBytes: number; + Created: Date; + LastWrite: Date; + LastSeen: Date; + LastHandshake: Date; + Online: boolean; + KeepAlive: boolean; + ExitNode: boolean; + ExitNodeOption: boolean; + Active: boolean; } export interface TailscaleExitNodeStatus { - ID: string; - Online: boolean; + ID: string; + Online: boolean; TailscaleIPs: string[]; } export type TailscaleStatus = { - BackendState: TailscaleBackendState; - AuthURL: string; - Self: TailscalePeer, - User: Record | null; - CurrentTailnet: { - Name: string; - MagicDNSSuffix: string; - MagicDNSEnabled: boolean; - } | null; - ExitNodeStatus: TailscaleExitNodeStatus | null; - Peer: { - [key: string]: TailscalePeer - }; + BackendState: TailscaleBackendState; + AuthURL: string; + Self: TailscalePeer, + CurrentTailnet: { + Name: string; + MagicDNSSuffix: string; + MagicDNSEnabled: boolean; + } | null; + ExitNodeStatus: TailscaleExitNodeStatus | null; + User: Record | null; + Peer: Record | null; }; export type TailscaleUser = { - ID: number; - LoginName: string; - DisplayName: string; - ProfilePicURL: string; - Roles: string[]; + ID: number; + LoginName: string; + DisplayName: string; + ProfilePicURL: string; + Roles: string[]; }; export type TailscaleUp = { - BackendState: TailscaleBackendState; - AuthURL?: string; - QR?: string; + BackendState: TailscaleBackendState; + AuthURL?: string; + QR?: string; }; \ No newline at end of file