diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-10-05 11:20:09 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-10-05 15:50:40 +0200 |
| commit | 5cf09ec693285d9cfa947ce794b900645ca16e54 (patch) | |
| tree | fe1bf132a1e29a3776059b8e32b1ee1484dd58be | |
| parent | 3e33f9dcfbdf9ac24ef222a12868798cf9f22cf8 (diff) | |
| download | mullvadvpn-5cf09ec693285d9cfa947ce794b900645ca16e54.tar.xz mullvadvpn-5cf09ec693285d9cfa947ce794b900645ca16e54.zip | |
Don't rely on exit ip in relay_list
Instead, show the hostname in the UI
| -rw-r--r-- | gui/packages/desktop/src/renderer/app.js | 2 | ||||
| -rw-r--r-- | gui/packages/desktop/src/renderer/components/Connect.js | 15 | ||||
| -rw-r--r-- | gui/packages/desktop/src/renderer/components/ConnectStyles.js | 3 | ||||
| -rw-r--r-- | gui/packages/desktop/src/renderer/lib/daemon-rpc.js | 3 | ||||
| -rw-r--r-- | mullvad-cli/src/cmds/status.rs | 4 | ||||
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 5 | ||||
| -rw-r--r-- | mullvad-types/src/location.rs | 2 | ||||
| -rw-r--r-- | mullvad-types/src/relay_list.rs | 1 |
8 files changed, 15 insertions, 20 deletions
diff --git a/gui/packages/desktop/src/renderer/app.js b/gui/packages/desktop/src/renderer/app.js index e973340107..ad7cea7c74 100644 --- a/gui/packages/desktop/src/renderer/app.js +++ b/gui/packages/desktop/src/renderer/app.js @@ -339,12 +339,12 @@ export default class AppRenderer { log.info('Got location from daemon'); const locationUpdate = { - ip: location.ip, country: location.country, city: location.city, latitude: location.latitude, longitude: location.longitude, mullvadExitIp: location.mullvad_exit_ip, + hostname: location.hostname, }; actions.connection.newLocation(locationUpdate); diff --git a/gui/packages/desktop/src/renderer/components/Connect.js b/gui/packages/desktop/src/renderer/components/Connect.js index 9fc7a7de61..11fb6d9d70 100644 --- a/gui/packages/desktop/src/renderer/components/Connect.js +++ b/gui/packages/desktop/src/renderer/components/Connect.js @@ -176,7 +176,7 @@ export default class Connect extends Component<Props> { selectedRelayName={this.props.selectedRelayName} city={this.props.connection.city} country={this.props.connection.country} - ip={this.props.connection.ip} + hostname={this.props.connection.hostname} onConnect={this.props.onConnect} onDisconnect={this.props.onDisconnect} onSelectLocation={this.props.onSelectLocation} @@ -318,13 +318,7 @@ export function TunnelControl(props: TunnelControlProps) { const Location = ({ children }) => <View style={styles.status_location}>{children}</View>; const City = () => <Text style={styles.status_location_text}>{props.city}</Text>; const Country = () => <Text style={styles.status_location_text}>{props.country}</Text>; - const Ip = () => ( - <ClipboardLabel - style={styles.status_ipaddress} - value={props.ip || ''} - message={'IP copied to clipboard!'} - /> - ); + const Hostname = () => <Text style={styles.status_hostname}>{props.hostname || ''}</Text>; const SwitchLocation = () => { return ( @@ -379,6 +373,7 @@ export function TunnelControl(props: TunnelControlProps) { <Location> <City /> </Location> + <Hostname /> </Body> <Footer> <SwitchLocation /> @@ -395,7 +390,7 @@ export function TunnelControl(props: TunnelControlProps) { <City /> <Country /> </Location> - <Ip /> + <Hostname /> </Body> <Footer> <SwitchLocation /> @@ -425,7 +420,6 @@ export function TunnelControl(props: TunnelControlProps) { <Location> <Country /> </Location> - <Ip /> </Body> <Footer> <SelectedLocation /> @@ -442,7 +436,6 @@ export function TunnelControl(props: TunnelControlProps) { <Location> <Country /> </Location> - <Ip /> </Body> <Footer> <SelectedLocation /> diff --git a/gui/packages/desktop/src/renderer/components/ConnectStyles.js b/gui/packages/desktop/src/renderer/components/ConnectStyles.js index b882afb930..54b784c415 100644 --- a/gui/packages/desktop/src/renderer/components/ConnectStyles.js +++ b/gui/packages/desktop/src/renderer/components/ConnectStyles.js @@ -76,11 +76,12 @@ export default { lineHeight: 22, marginBottom: 4, }), - status_ipaddress: Styles.createTextStyle({ + status_hostname: Styles.createTextStyle({ fontFamily: 'Open Sans', fontSize: 16, fontWeight: '800', color: colors.white, + paddingBottom: 2, }), status_location: Styles.createTextStyle({ flexDirection: 'column', diff --git a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js index cece79f783..8192f967b9 100644 --- a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js +++ b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js @@ -33,12 +33,12 @@ export type Location = { mullvad_exit_ip: boolean, }; const LocationSchema = object({ - ip: string, country: string, city: maybe(string), latitude: number, longitude: number, mullvad_exit_ip: boolean, + hostname: maybe(string), }); export type BlockReason = @@ -207,7 +207,6 @@ const RelayListSchema = object({ object({ hostname: string, ipv4_addr_in: string, - ipv4_addr_exit: string, include_in_country: boolean, weight: number, }), diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs index 06d75380aa..11e436d34a 100644 --- a/mullvad-cli/src/cmds/status.rs +++ b/mullvad-cli/src/cmds/status.rs @@ -58,11 +58,13 @@ fn print_location(rpc: &mut DaemonRpcClient) -> Result<()> { } else { format!("{}", location.country) }; + if let Some(hostname) = location.hostname { + println!("Relay: {}", hostname); + } println!("Location: {}", city_and_country); println!( "Position: {:.5}°N, {:.5}°W", location.latitude, location.longitude ); - println!("IP: {}", location.ip); Ok(()) } diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index 76ec9004ba..063e68d56e 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -61,7 +61,7 @@ use mullvad_types::{ version::{AppVersion, AppVersionInfo}, }; -use std::{mem, net::IpAddr, path::PathBuf, sync::mpsc, thread, time::Duration}; +use std::{mem, path::PathBuf, sync::mpsc, thread, time::Duration}; use talpid_core::{ mpsc::IntoSender, @@ -411,13 +411,14 @@ impl Daemon { fn on_get_current_location(&self, tx: OneshotSender<GeoIpLocation>) { if let Some(ref relay) = self.current_relay { let location = relay.location.as_ref().cloned().unwrap(); + let hostname = relay.hostname.clone(); let geo_ip_location = GeoIpLocation { - ip: IpAddr::V4(relay.ipv4_addr_exit), country: location.country, city: Some(location.city), latitude: location.latitude, longitude: location.longitude, mullvad_exit_ip: true, + hostname: Some(hostname), }; Self::oneshot_send(tx, geo_ip_location, "current location"); } else { diff --git a/mullvad-types/src/location.rs b/mullvad-types/src/location.rs index 5d14318da6..2e14537043 100644 --- a/mullvad-types/src/location.rs +++ b/mullvad-types/src/location.rs @@ -16,10 +16,10 @@ pub struct Location { #[derive(Debug, Serialize, Deserialize)] pub struct GeoIpLocation { - pub ip: IpAddr, pub country: String, pub city: Option<String>, pub latitude: f64, pub longitude: f64, pub mullvad_exit_ip: bool, + pub hostname: Option<String>, } diff --git a/mullvad-types/src/relay_list.rs b/mullvad-types/src/relay_list.rs index cc970c2ee8..5f24285dac 100644 --- a/mullvad-types/src/relay_list.rs +++ b/mullvad-types/src/relay_list.rs @@ -38,7 +38,6 @@ pub struct RelayListCity { pub struct Relay { pub hostname: String, pub ipv4_addr_in: Ipv4Addr, - pub ipv4_addr_exit: Ipv4Addr, pub include_in_country: bool, pub weight: u64, #[serde(skip_serializing_if = "RelayTunnels::is_empty", default)] |
