Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1119)

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/DirectRTCClient.java

Issue 2009493002: Improve IP_PATTERN in DirectRTCClient in Android AppRTC Demo (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixes according to magjed's comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 24 matching lines...) Expand all
35 private static final int DEFAULT_PORT = 8888; 35 private static final int DEFAULT_PORT = 8888;
36 36
37 // Regex pattern used for checking if room id looks like an IP. 37 // Regex pattern used for checking if room id looks like an IP.
38 static final Pattern IP_PATTERN = Pattern.compile( 38 static final Pattern IP_PATTERN = Pattern.compile(
39 "(" 39 "("
40 // IPv4 40 // IPv4
41 + "((\\d+\\.){3}\\d+)|" 41 + "((\\d+\\.){3}\\d+)|"
42 // IPv6 42 // IPv6
43 + "\\[((([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?::" 43 + "\\[((([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?::"
44 + "(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?)\\]|" 44 + "(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?)\\]|"
45 + "\\[(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})\\]|" 45 + "\\[(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4})\\]|"
46 // IPv6 without [] 46 // IPv6 without []
47 + "((([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?::(([0-9a-fA-F]{1,4}:)*[0-9a- fA-F]{1,4})?)|" 47 + "((([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?::(([0-9a-fA-F]{1,4}:)*[0-9a- fA-F]{1,4})?)|"
48 + "(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})|" 48 + "(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4})|"
49 // Literals 49 // Literals
50 + "localhost" 50 + "localhost"
51 + ")" 51 + ")"
52 // Optional port number 52 // Optional port number
53 + "(:(\\d+))?" 53 + "(:(\\d+))?"
54 ); 54 );
55 55
56 private final ExecutorService executor; 56 private final ExecutorService executor;
57 private final SignalingEvents events; 57 private final SignalingEvents events;
58 private TCPChannelClient tcpClient; 58 private TCPChannelClient tcpClient;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 return json; 345 return json;
346 } 346 }
347 347
348 // Converts a JSON candidate to a Java object. 348 // Converts a JSON candidate to a Java object.
349 private static IceCandidate toJavaCandidate(JSONObject json) throws JSONExcept ion { 349 private static IceCandidate toJavaCandidate(JSONObject json) throws JSONExcept ion {
350 return new IceCandidate(json.getString("id"), 350 return new IceCandidate(json.getString("id"),
351 json.getInt("label"), 351 json.getInt("label"),
352 json.getString("candidate")); 352 json.getString("candidate"));
353 } 353 }
354 } 354 }
OLDNEW
« no previous file with comments | « no previous file | webrtc/examples/androidjunit/src/org/appspot/apprtc/DirectRTCClientTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698