package com.tencent.tmsbeacon.base.net.b; import android.text.TextUtils; import com.jingdong.sdk.jdhttpdns.config.HttpDnsConfig; import com.tencent.mapsdk.internal.m2; import com.tencent.tmsbeacon.base.util.c; import com.tencent.tmsbeacon.base.util.e; import java.util.regex.Matcher; import java.util.regex.Pattern; /* compiled from: TMS */ public final class b { public static String a = "https://otheve.beacon.qq.com/analytics/v2_upload"; public static String b = "https://othstr.beacon.qq.com/analytics/v2_upload"; /* renamed from: c reason: collision with root package name */ public static String f2408c = "oth.eve.mdt.qq.com"; public static String d = "oth.str.mdt.qq.com"; private static boolean e; public static String a(String str) { if (str == null || "".equals(str)) { return ""; } String str2 = str.contains(m2.l) ? HttpDnsConfig.SCHEMA_HTTPS : HttpDnsConfig.SCHEMA_HTTP; int indexOf = str.indexOf(str2); if (indexOf == -1) { return str; } String substring = str.substring(indexOf + str2.length(), str.indexOf("/", str2.length())); int indexOf2 = substring.indexOf(":"); return indexOf2 != -1 ? substring.substring(0, indexOf2) : substring; } public static void b(String str) { if (!TextUtils.isEmpty(str) && !e) { f2408c = str; } } public static void c(String str) { if (!TextUtils.isEmpty(str) && !e) { a = str; } } public static void d(String str) { if (!TextUtils.isEmpty(str) && !e) { d = str; } } public static void e(String str) { if (!TextUtils.isEmpty(str) && !e) { b = str; } } public static String b(boolean z) { return z ? d : b; } public static void b(String str, String str2) { Pattern compile = Pattern.compile("((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})(\\.((2(5[0-5]|[0-4]\\d))|[0-1]?\\d{1,2})){3}"); Matcher matcher = compile.matcher(str); Matcher matcher2 = compile.matcher(str2); if (!matcher.matches() || !matcher2.matches()) { e.a("[event url] set report ip is not valid IP address!"); return; } d = str; b = b.replace("othstr.beacon.qq.com", str); f2408c = str2; String replace = a.replace("otheve.beacon.qq.com", str2); a = replace; c.a("[event url] ip modified by api, socketStrategyHost: %s, httpsStrategyUrl: %s, socketLogHost: %s ,httpsLogUrl: %s", d, b, f2408c, replace); } public static String a(boolean z) { return z ? f2408c : a; } public static void a(String str, String str2) { if (!TextUtils.isEmpty(str)) { d = str; b = b.replace("othstr.beacon.qq.com", str); e = true; } if (!TextUtils.isEmpty(str2)) { f2408c = str2; a = a.replace("otheve.beacon.qq.com", str2); e = true; } } }