diff --git a/api.proto b/api.proto index 886ddac..1fe4ef2 100644 --- a/api.proto +++ b/api.proto @@ -85,7 +85,8 @@ service Listener { // StatusUpdates opens a stream to listen to connection status updates // a client has to subscribe and continuously // listen to the broadcasted updates - rpc StatusUpdates(StatusUpdatesRequest) returns (stream ConnectionStatusUpdate); + rpc StatusUpdates(StatusUpdatesRequest) + returns (stream ConnectionStatusUpdate); } message ListenerUpdateRequest { @@ -211,10 +212,18 @@ message ClientCertFromStore { optional string subject_filter = 2; } +enum Protocol { + UNKNOWN = 0; + TCP = 1; + UDP = 2; +} + // Connection message Connection { // name is a user friendly connection name that a user may define optional string name = 1; + // the protocol to use for the connection + optional Protocol protocol = 10; // remote_addr is a remote pomerium host:port string remote_addr = 2; // listen_address, if not provided, will assign a random port each time diff --git a/src/renderer/pages/ConnectForm.tsx b/src/renderer/pages/ConnectForm.tsx index 5873b18..e1d9684 100644 --- a/src/renderer/pages/ConnectForm.tsx +++ b/src/renderer/pages/ConnectForm.tsx @@ -8,10 +8,15 @@ import { CardContent, Chip, Container, + FormControl, FormControlLabel, FormHelperText, Grid, IconButton, + InputLabel, + MenuItem, + Select, + SelectChangeEvent, styled, Switch, Typography, @@ -38,6 +43,7 @@ import { formatTag } from '../../shared/validators'; import { ClientCertFromStore, Connection, + Protocol, Record, Selector, } from '../../shared/pb/api'; @@ -115,6 +121,7 @@ interface Props { const initialConnData: Connection = { name: undefined, + protocol: Protocol.TCP, remoteAddr: '', listenAddr: undefined, pomeriumUrl: undefined, @@ -239,7 +246,7 @@ const ConnectForm: FC = () => { useState(false); const saveClientCertFromStore = ( - value: ClientCertFromStore | undefined, + value: ClientCertFromStore | undefined ): void => { setConnection({ ...connection, @@ -265,7 +272,7 @@ const ConnectForm: FC = () => { }; const clientCertFiltersSummary = getClientCertFiltersSummary( - connection?.clientCertFromStore, + connection?.clientCertFromStore ); const saveCertText = (value: string): void => { @@ -310,6 +317,14 @@ const ConnectForm: FC = () => { setShowCertInput(true); }; + const handleChangeProtocol = (evt: SelectChangeEvent) => { + setConnection((oldConnection) => { + oldConnection.protocol = + evt.target.value === 'UDP' ? Protocol.UDP : Protocol.TCP; + return oldConnection; + }); + }; + const saveConnection = (): void => { const record = { tags, @@ -552,6 +567,23 @@ const ConnectForm: FC = () => { helperText="Name of the route." /> + + + Protocol + + +