From d2c70f4132ac4f5719c32d47829f63b1b00f6903 Mon Sep 17 00:00:00 2001 From: Ridhwan Ikhwanto Date: Thu, 13 Jul 2023 11:53:49 +0700 Subject: [PATCH] Use [address]:port notation for IPv6 --- .../remote_capture/fragments/ConnectionOverview.java | 9 +++++++-- app/src/main/res/values/strings.xml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/emanuelef/remote_capture/fragments/ConnectionOverview.java b/app/src/main/java/com/emanuelef/remote_capture/fragments/ConnectionOverview.java index d38663c8..32703c0b 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/fragments/ConnectionOverview.java +++ b/app/src/main/java/com/emanuelef/remote_capture/fragments/ConnectionOverview.java @@ -163,8 +163,13 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat source.setText(mConn.src_ip); destination.setText(mConn.dst_ip); } else { - source.setText(String.format(getResources().getString(R.string.ip_and_port), mConn.src_ip, mConn.src_port)); - destination.setText(String.format(getResources().getString(R.string.ip_and_port), mConn.dst_ip, mConn.dst_port)); + if (mConn.ipver == 6) { + source.setText(String.format(getResources().getString(R.string.ipv6_and_port), mConn.src_ip, mConn.src_port)); + destination.setText(String.format(getResources().getString(R.string.ipv6_and_port), mConn.dst_ip, mConn.dst_port)); + } else { + source.setText(String.format(getResources().getString(R.string.ip_and_port), mConn.src_ip, mConn.src_port)); + destination.setText(String.format(getResources().getString(R.string.ip_and_port), mConn.dst_ip, mConn.dst_port)); + } } if((mConn.info != null) && (!mConn.info.isEmpty())) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 09768ee3..aa201853 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,6 +3,7 @@ 127.0.0.1 1234 %1$s:%2$d + [%1$s]:%2$d %1$s (%2$s) SNI URL