summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2018-10-05 16:18:28 +0200
committerLinus Färnstrand <linus@mullvad.net>2018-10-05 16:18:28 +0200
commitf18fefd5e5fc3ac2fa66b5fa667be42e518d9013 (patch)
treea36f5269571820196ac9bbd2d0eff000a97d1a65
parent3e33f9dcfbdf9ac24ef222a12868798cf9f22cf8 (diff)
parent0bd4165557516d0a21603e524b97d6c2d9689575 (diff)
downloadmullvadvpn-f18fefd5e5fc3ac2fa66b5fa667be42e518d9013.tar.xz
mullvadvpn-f18fefd5e5fc3ac2fa66b5fa667be42e518d9013.zip
Merge branch 'show-hostname-not-ip'
-rw-r--r--CHANGELOG.md3
-rw-r--r--gui/packages/desktop/src/renderer/app.js16
-rw-r--r--gui/packages/desktop/src/renderer/components/Connect.js20
-rw-r--r--gui/packages/desktop/src/renderer/components/ConnectStyles.js3
-rw-r--r--gui/packages/desktop/src/renderer/lib/daemon-rpc.js9
-rw-r--r--gui/packages/desktop/src/renderer/redux/connection/actions.js4
-rw-r--r--mullvad-cli/src/cmds/status.rs4
-rw-r--r--mullvad-daemon/src/lib.rs5
-rw-r--r--mullvad-types/src/location.rs5
-rw-r--r--mullvad-types/src/relay_list.rs1
10 files changed, 26 insertions, 44 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7037ffebab..8e5c2a76c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,9 +30,10 @@ Line wrap the file at 100 chars. Th
#### Linux
- Add support for DNS configuration using systemd-resolved and NetworkManager.
-
### Changed
- Auto-hide scrollbars on macOS only, leaving them visible on other platforms.
+- Instead of showing the public IP of the device in the UI, we show the hostname of the VPN server
+ the app is connected to. Or nothing if not connected anywhere.
#### Linux
- Moved CLI binary to `/usr/bin/` as to have the CLI binary in the user's `$PATH` by default.
diff --git a/gui/packages/desktop/src/renderer/app.js b/gui/packages/desktop/src/renderer/app.js
index e973340107..61714cb757 100644
--- a/gui/packages/desktop/src/renderer/app.js
+++ b/gui/packages/desktop/src/renderer/app.js
@@ -333,21 +333,7 @@ export default class AppRenderer {
}
async _fetchLocation() {
- const actions = this._reduxActions;
- const location = await this._daemonRpc.getLocation();
-
- 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,
- };
-
- actions.connection.newLocation(locationUpdate);
+ this._reduxActions.connection.newLocation(await this._daemonRpc.getLocation());
}
async setAllowLan(allowLan: boolean) {
diff --git a/gui/packages/desktop/src/renderer/components/Connect.js b/gui/packages/desktop/src/renderer/components/Connect.js
index 9fc7a7de61..b514d63f15 100644
--- a/gui/packages/desktop/src/renderer/components/Connect.js
+++ b/gui/packages/desktop/src/renderer/components/Connect.js
@@ -3,7 +3,7 @@
import moment from 'moment';
import * as React from 'react';
import { Component, Text, View, Types } from 'reactxp';
-import { Accordion, ClipboardLabel, SecuredLabel, SecuredDisplayStyle } from '@mullvad/components';
+import { Accordion, SecuredLabel, SecuredDisplayStyle } from '@mullvad/components';
import { Layout, Container, Header } from './Layout';
import { SettingsBarButton, Brand } from './HeaderBar';
import BlockingInternetBanner, { BannerTitle, BannerSubtitle } from './BlockingInternetBanner';
@@ -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}
@@ -307,7 +307,7 @@ type TunnelControlProps = {
selectedRelayName: string,
city: ?string,
country: ?string,
- ip: ?string,
+ hostname: ?string,
onConnect: () => void,
onDisconnect: () => void,
onSelectLocation: () => void,
@@ -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 (
@@ -378,7 +372,9 @@ export function TunnelControl(props: TunnelControlProps) {
<Secured displayStyle={SecuredDisplayStyle.securing} />
<Location>
<City />
+ <Country />
</Location>
+ <Hostname />
</Body>
<Footer>
<SwitchLocation />
@@ -395,7 +391,7 @@ export function TunnelControl(props: TunnelControlProps) {
<City />
<Country />
</Location>
- <Ip />
+ <Hostname />
</Body>
<Footer>
<SwitchLocation />
@@ -425,7 +421,6 @@ export function TunnelControl(props: TunnelControlProps) {
<Location>
<Country />
</Location>
- <Ip />
</Body>
<Footer>
<SelectedLocation />
@@ -442,7 +437,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..12c1e0a214 100644
--- a/gui/packages/desktop/src/renderer/lib/daemon-rpc.js
+++ b/gui/packages/desktop/src/renderer/lib/daemon-rpc.js
@@ -25,20 +25,20 @@ export type AccountData = { expiry: string };
export type AccountToken = string;
export type Ip = string;
export type Location = {
- ip: Ip,
country: string,
city: ?string,
latitude: number,
longitude: number,
mullvad_exit_ip: boolean,
+ hostname: ?string,
};
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,
}),
@@ -454,7 +453,7 @@ export class DaemonRpc implements DaemonRpcProtocol {
async getLocation(): Promise<Location> {
const response = await this._transport.send('get_current_location', [], NETWORK_CALL_TIMEOUT);
try {
- return validate(LocationSchema, response);
+ return camelCaseObjectKeys(validate(LocationSchema, response));
} catch (error) {
throw new ResponseParseError('Invalid response from get_current_location', error);
}
@@ -463,7 +462,7 @@ export class DaemonRpc implements DaemonRpcProtocol {
async getState(): Promise<TunnelStateTransition> {
const response = await this._transport.send('get_state');
try {
- return validate(TunnelStateTransitionSchema, response);
+ return camelCaseObjectKeys(validate(TunnelStateTransitionSchema, response));
} catch (error) {
throw new ResponseParseError('Invalid response from get_state', error);
}
diff --git a/gui/packages/desktop/src/renderer/redux/connection/actions.js b/gui/packages/desktop/src/renderer/redux/connection/actions.js
index 5b4793f1cc..668eb2a67b 100644
--- a/gui/packages/desktop/src/renderer/redux/connection/actions.js
+++ b/gui/packages/desktop/src/renderer/redux/connection/actions.js
@@ -1,6 +1,6 @@
// @flow
-import type { AfterDisconnect, BlockReason, Ip } from '../../lib/daemon-rpc';
+import type { AfterDisconnect, BlockReason } from '../../lib/daemon-rpc';
type ConnectingAction = {
type: 'CONNECTING',
@@ -27,12 +27,12 @@ type BlockedAction = {
type NewLocationAction = {
type: 'NEW_LOCATION',
newLocation: {
- ip: Ip,
country: string,
city: ?string,
latitude: number,
longitude: number,
mullvadExitIp: boolean,
+ hostname: ?string,
},
};
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..57d1e31269 100644
--- a/mullvad-types/src/location.rs
+++ b/mullvad-types/src/location.rs
@@ -1,5 +1,3 @@
-use std::net::IpAddr;
-
pub type CountryCode = String;
pub type CityCode = String;
pub type Hostname = String;
@@ -16,10 +14,11 @@ 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,
+ #[serde(default)]
+ 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)]