Add Debug output
This commit is contained in:
parent
f0e2e22b73
commit
5d9158ca66
@ -11,6 +11,7 @@ import de.measite.minidns.DNSMessage;
|
||||
import de.measite.minidns.Record;
|
||||
import de.measite.minidns.record.A;
|
||||
import de.measite.minidns.record.AAAA;
|
||||
import org.itxtech.daedalus.Daedalus;
|
||||
import org.itxtech.daedalus.service.DaedalusVpnService;
|
||||
import org.itxtech.daedalus.util.Logger;
|
||||
import org.itxtech.daedalus.util.RuleResolver;
|
||||
@ -216,12 +217,13 @@ public class UdpProvider extends Provider {
|
||||
* @param responsePayload The payload of the response
|
||||
*/
|
||||
void handleDnsResponse(IpPacket requestPacket, byte[] responsePayload) {
|
||||
/*try {
|
||||
DNSMessage message = new DNSMessage(responsePayload);
|
||||
Logger.info(message.toString());
|
||||
} catch (IOException e) {
|
||||
Logger.logException(e);
|
||||
}*/
|
||||
if (Daedalus.getPrefs().getBoolean("settings_debug_output", false)) {
|
||||
try {
|
||||
Logger.debug(new DNSMessage(responsePayload).toString());
|
||||
} catch (IOException e) {
|
||||
Logger.logException(e);
|
||||
}
|
||||
}
|
||||
UdpPacket udpOutPacket = (UdpPacket) requestPacket.getPayload();
|
||||
UdpPacket.Builder payLoadBuilder = new UdpPacket.Builder(udpOutPacket)
|
||||
.srcPort(udpOutPacket.getHeader().getDstPort())
|
||||
@ -308,6 +310,9 @@ public class UdpProvider extends Provider {
|
||||
DNSMessage dnsMsg;
|
||||
try {
|
||||
dnsMsg = new DNSMessage(dnsRawData);
|
||||
if (Daedalus.getPrefs().getBoolean("settings_debug_output", false)) {
|
||||
Logger.debug(dnsMsg.toString());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.i(TAG, "handleDnsRequest: Discarding non-DNS or invalid packet", e);
|
||||
return;
|
||||
|
@ -81,6 +81,7 @@
|
||||
<string name="action_log">日志</string>
|
||||
<string name="action_refresh">刷新</string>
|
||||
<string name="settings_log_size">日志大小限制</string>
|
||||
<string name="settings_debug_output">调试输出</string>
|
||||
<string name="server_cutedns_south_china">CuteDNS 华南</string>
|
||||
<string name="settings_allow_dynamic_rule_reload">允许动态更新规则</string>
|
||||
<string name="action_reload">重新加载规则</string>
|
||||
|
@ -81,6 +81,7 @@
|
||||
<string name="action_log">紀錄檔</string>
|
||||
<string name="action_refresh">重新整理</string>
|
||||
<string name="settings_log_size">紀錄檔大小限制</string>
|
||||
<string name="settings_debug_output">调试输出 TODO</string>
|
||||
<string name="server_cutedns_south_china">CuteDNS 中國華南</string>
|
||||
<string name="settings_allow_dynamic_rule_reload">允許動態規則重新載入</string>
|
||||
<string name="action_reload">重新載入</string>
|
||||
|
@ -63,6 +63,7 @@
|
||||
<string name="settings_manual">Manual</string>
|
||||
<string name="settings_manual_summary">Visit GitHub wiki page.</string>
|
||||
<string name="settings_allow_dynamic_rule_reload">Allow dynamic rule reload</string>
|
||||
<string name="settings_debug_output">Debug output</string>
|
||||
|
||||
<string name="settings_rule_name">Rule Name</string>
|
||||
<string name="settings_rule_type">Rule Type</string>
|
||||
|
@ -71,6 +71,11 @@
|
||||
android:title="@string/settings_dns_over_tcp"
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"/>
|
||||
<SwitchPreference
|
||||
android:key="settings_debug_output"
|
||||
android:title="@string/settings_debug_output"
|
||||
android:defaultValue="false"
|
||||
android:enabled="false"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
Loading…
Reference in New Issue
Block a user