Bug Fixes

master
msmannan00 2020-10-05 16:12:00 +05:00
parent c4794b89ce
commit 70947fa670
2032 changed files with 307685 additions and 3889 deletions

3
.gitignore vendored
View File

@ -11,3 +11,6 @@
/build
/captures
.externalNativeBuild
java_pid10832.hprof
java_pid17480.hprof
java_pid21508.hprof

45
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,45 @@
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.2"
ANDROID_SDK_TOOLS: "4333796"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x ./gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
stages:
- build
# - test
#lintDebug:
# stage: build
# script:
# - ./gradlew -Pci --console=plain :app:lintDebug -PbuildDir=lint
assembleDebug:
stage: build
script:
- ./gradlew assembleDebug
artifacts:
paths:
- app/build/outputs/
#debugTests:
# stage: test
# script:
# - ./gradlew -Pci --console=plain :app:testReleaseflavorDebugUnitTest

12
.gitmodules vendored Normal file
View File

@ -0,0 +1,12 @@
[submodule "external/jtorctl"]
path = external/jtorctl
url = https://github.com/guardianproject/jtorctl
ignore = dirty
[submodule "external/badvpn"]
path = external/badvpn
url = https://github.com/guardianproject/badvpn.git
ignore = dirty
[submodule "external/jsocks"]
path = external/jsocks
url = https://github.com/guardianproject/jsocks.git
ignore = dirty

View File

@ -17,15 +17,14 @@
<package name="" alias="true" withSubpackages="true" />
</value>
</option>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="JAVA">
<option name="BRACE_STYLE" value="2" />
<option name="CLASS_BRACE_STYLE" value="2" />
<option name="METHOD_BRACE_STYLE" value="2" />
<option name="LAMBDA_BRACE_STYLE" value="2" />
</codeStyleSettings>
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
@ -134,8 +133,5 @@
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

View File

@ -7,6 +7,7 @@
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />

View File

@ -1,6 +1,25 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Convert2MethodRef" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="ConstantConditions" enabled="false" level="WARNING" enabled_by_default="false">
<option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" />
<option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" />
</inspection_tool>
<inspection_tool class="FieldCanBeLocal" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="RawTypeCanBeGeneric" enabled="false" level="INFORMATION" enabled_by_default="false" />
<inspection_tool class="RawUseOfParameterizedType" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SameParameterValue" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="SuspiciousListRemoveInLoop" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UNCHECKED_WARNING" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="UnnecessaryLocalVariable" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreImmediatelyReturnedVariables" value="false" />
<option name="m_ignoreAnnotatedVariables" value="false" />
</inspection_tool>
<inspection_tool class="UnusedReturnValue" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownEnhProjectSettings">
<AnnotatorSettings targetHasSpaces="true" linkCaseMismatch="true" wikiCaseMismatch="true" wikiLinkHasDashes="true" notUnderWikiHome="true" targetNotWikiPageExt="true" notUnderSourceWikiHome="true" targetNameHasAnchor="true" targetPathHasAnchor="true" wikiLinkHasSlash="true" wikiLinkHasSubdir="true" wikiLinkHasOnlyAnchor="true" linkTargetsWikiHasExt="true" linkTargetsWikiHasBadExt="true" notUnderSameRepo="true" targetNotUnderVcs="false" linkNeedsExt="true" linkHasBadExt="true" linkTargetNeedsExt="true" linkTargetHasBadExt="true" wikiLinkNotInWiki="true" imageTargetNotInRaw="true" repoRelativeAcrossVcsRoots="true" multipleWikiTargetsMatch="true" unresolvedLinkReference="true" linkIsIgnored="true" anchorIsIgnored="true" anchorIsUnresolved="true" anchorLineReferenceIsUnresolved="true" anchorLineReferenceFormat="true" anchorHasDuplicates="true" abbreviationDuplicates="true" abbreviationNotUsed="true" attributeIdDuplicateDefinition="true" attributeIdNotUsed="true" footnoteDuplicateDefinition="true" footnoteUnresolved="true" footnoteDuplicates="true" footnoteNotUsed="true" macroDuplicateDefinition="true" macroUnresolved="true" macroDuplicates="true" macroNotUsed="true" referenceDuplicateDefinition="true" referenceUnresolved="true" referenceDuplicates="true" referenceNotUsed="true" referenceUnresolvedNumericId="true" enumRefDuplicateDefinition="true" enumRefUnresolved="true" enumRefDuplicates="true" enumRefNotUsed="true" enumRefLinkUnresolved="true" enumRefLinkDuplicates="true" simTocUpdateNeeded="true" simTocTitleSpaceNeeded="true" />
<HtmlExportSettings updateOnSave="false" parentDir="" targetDir="" cssDir="css" scriptDir="js" plainHtml="false" imageDir="" copyLinkedImages="false" imagePathType="0" targetPathType="2" targetExt="" useTargetExt="false" noCssNoScripts="false" useElementStyleAttribute="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
<LinkMapSettings>
<textMaps />
</LinkMapSettings>
</component>
</project>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownProjectSettings">
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" synchronizePreviewPosition="true" highlightPreviewType="LINE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="true" showSelectionInPreview="true" lastLayoutSetsDefault="false">
<PanelProvider>
<provider providerId="com.vladsch.md.nav.editor.swing.html.panel" providerName="Default - Swing" />
</PanelProvider>
</PreviewSettings>
<ParserSettings gitHubSyntaxChange="false" correctedInvalidSettings="false" emojiShortcuts="1" emojiImages="0">
<PegdownExtensions>
<option name="ATXHEADERSPACE" value="true" />
<option name="FENCED_CODE_BLOCKS" value="true" />
<option name="INTELLIJ_DUMMY_IDENTIFIER" value="true" />
<option name="RELAXEDHRULES" value="true" />
<option name="STRIKETHROUGH" value="true" />
<option name="TABLES" value="true" />
<option name="TASKLISTITEMS" value="true" />
</PegdownExtensions>
<ParserOptions>
<option name="COMMONMARK_LISTS" value="true" />
<option name="EMOJI_SHORTCUTS" value="true" />
<option name="GFM_TABLE_RENDERING" value="true" />
<option name="PRODUCTION_SPEC_PARSER" value="true" />
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
</ParserOptions>
</ParserSettings>
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" addPageHeader="false" addAnchorLinks="false" anchorLinksWrapText="false" imageUriSerials="false" addDocTypeHtml="true" noParaTags="false" defaultUrlTitle="false" migratedPlantUml="true" migratedAnchorLinks="true" plantUmlConversion="0">
<GeneratorProvider>
<provider providerId="com.vladsch.md.nav.editor.text.html.generator" providerName="Unmodified HTML Generator" />
</GeneratorProvider>
<headerTop />
<headerBottom />
<bodyTop />
<bodyBottom />
<fencedCodeConversions>
<option name="c4plantuml" value="NONE" />
<option name="ditaa" value="NONE" />
<option name="erd" value="NONE" />
<option name="graphviz" value="NONE" />
<option name="latex" value="KATEX" />
<option name="math" value="KATEX" />
<option name="mermaid" value="NONE" />
<option name="nomnoml" value="NONE" />
<option name="plantuml" value="NONE" />
<option name="puml" value="NONE" />
<option name="svgbob" value="NONE" />
<option name="umlet" value="NONE" />
<option name="vega" value="NONE" />
<option name="vegalite" value="NONE" />
<option name="wavedrom" value="NONE" />
</fencedCodeConversions>
</HtmlSettings>
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssUriSerial="true" isCssTextEnabled="false" isDynamicPageWidth="true">
<StylesheetProvider>
<provider providerId="com.vladsch.md.nav.editor.text.html.css" providerName="No Stylesheet" />
</StylesheetProvider>
<ScriptProviders />
<cssText />
<cssUriHistory />
</CssSettings>
</component>
</project>

View File

@ -1,40 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
<option name="myDefaultNotNull" value="androidx.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="10">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="9">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>

View File

@ -1,6 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/shadowsocks-android" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/badvpn" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/libancillary" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/libevent" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/jni/redsocks" vcs="Git" />
<mapping directory="$PROJECT_DIR$/orbotservice/src/main/shadowsocks-android/core/src/main/rust/shadowsocks-rust" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/badvpn" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/libancillary" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/libevent" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/jni/redsocks" vcs="Git" />
<mapping directory="$PROJECT_DIR$/shadowsocks-android/core/src/main/rust/shadowsocks-rust" vcs="Git" />
</component>
</project>

44
AUTHORS Normal file
View File

@ -0,0 +1,44 @@
This file lists the authors for Orbot, a free software project to provide
anonymity on the Internet on Android smartphones.
For more information about Orbot, see https://guardianproject.info/apps/orbot
If you got this file as a part of a larger bundle, there are probably
other authors that you should be aware of.
Main Authors:
-------------
Nathan Freitas <nathan@freitas.net> developed the primary Android
application and managed the porting of Tor to Android.
Jake Appelbaum <jacob@appelbaum.net> regularly gave Nathan a swift kick
in the rear to get this done. He has also provided extensive guidance
and review. Most recently he has been promoted to Chief Application
Resource Editor.
Derek Halliday <derek@guardianproject.info> has designed and implemented
new user interface components and layouts since the 1.0.4 release.
Contributors:
-------------
Nick Mathewson <nickm@freehaven.net> wrote some of the patch code to
support the compiling of Tor and Libevent on Android, and generally
provided guidance in the entire effort.
Adam Langley made the original valiant effort to port Tor to Android.
Sathyanarayanan <gsathya@torproject.org> created a patch for the wizard
which updated the icon and link for the secure chat app info to point
to Gibberbot, and hopefully will continue to contribute useful patches.
__sporkbomb <manuel@acanthephyra.net> implemented an updated set of logic
in TorTransProxy for handling the "transproxy all" mode of operation. Before
certain system processes were leaking traffic, and this was also detected
by his excellent auditing.
Amogh Pradeep <amoghbl1@gmail.com> submitted a patch to address an issue
with the ongoing data transfer notification dying now and then, and is
working on improving the notification display in general
We found a nice new power button vector set here under the CC license:
http://vector4free.com/vector/free-vector-power-buttons/

46
BUILD.md Normal file
View File

@ -0,0 +1,46 @@
This document explains how to properly build an Android package of Orbot from
source.
Orbot includes, in the external directory, git repo submodules of:
- JTorControl: The Tor Control Library for Java
- BadVPN
- JSocks
Please install the following prerequisites (instructions for each follows):
- Android Software Development Kit or SDK (for Java code): http://developer.android.com/sdk/index.html *(Android Studio)*
- Android Native Development Kit or NDK (for C/C++ code) http://developer.android.com/sdk/ndk/index.html *(This can be installed through Android Studio's SDK Manager)*
Be sure that you have all of the git submodules up-to-date:
git submodule update --init --recursive
You then need to run "ndk-build" and the following commands to compile and prepare Orbot's native code:
UNIX:
cd orbotservice/src/main
ndk-build (located in Android/Sdk/ndk/VERSION/)
mv libs/armeabi-v7a/pdnsd libs/armeabi-v7a/pdnsd.so
mv libs/arm64-v8a/pdnsd libs/arm64-v8a/pdnsd.so
mv libs/x86/pdnsd libs/x86/pdnsd.so
mv libs/x86_64/pdnsd libs/x86_64/pdnsd.so
Windows:
cd orbotservice\src\main
ndk-build.cmd (located in Android\Sdk\ndk\VERSION\)
ren libs\armeabi-v7a\pdnsd pdnsd.so
ren libs\arm64-v8a\pdnsd pdnsd.so
ren libs\x86\pdnsd pdnsd.so
ren libs\x86_64\pdnsd pdnsd.so
Now build the Android app using Android Studio/gradle
This will produce an unsigned Orbot package APK.
To produce a usable package, you'll need to sign the .apk. The basics on signing can be found on the Android developer site:
http://developer.android.com/guide/publishing/app-signing.html

1974
CHANGELOG Normal file

File diff suppressed because it is too large Load Diff

5
FUNDING.yml Normal file
View File

@ -0,0 +1,5 @@
liberapay: GuardianProject
patreon: guardianproject
github:
- eighthave
- bitmold

40
INSTALL Normal file
View File

@ -0,0 +1,40 @@
Orbot: Android Onion Routing Robot
***********************************************
Orbot is a freely licensed open-source application developed for the
Android platform. It acts as a front-end to the Tor binary application,
and also provides an HTTP Proxy for connecting web browsers and other
HTTP client applications into the Tor SOCKS interface.
*** PreReqs ***
You need the Android Developer SDK to compile and build the APK file:
http://developer.android.com/
The project files including in this distribution are meant to be used
with Eclipse: http://eclipse.org/
*** How to use ***
Currently, Orbot will work with any application that supports using
an HTTP or SOCKS Proxy. Once you start Tor using Orbot, you can then
point your application to HTTP port 8118 or SOCKS port 9050 on localhost
IP 127.0.0.1.
If you have root access, and a version of Android with iptables that
supports the netfilter owner module, then Orbot can setup transparent
proxying for any application.
Finally, Firefox on Android is available, and we have released an
add-on named ProxyMob for configuring SOCKS proxy settings for use
with the local Tor socks proxy.
** A Few Notes **
To ensure you are connected to the Tor network, you should browse to
https://check.torproject.org/
The first time you activate Orbot, it may take a while to connect to
Tor. Check the message log to ensure you are "100% Bootstrapped".
***********************************************
/* Copyright (c) 2009,2010,2011, Nathan Freitas, The Guardian Project
* http://guardianproject.info/ */

224
LICENSE Normal file
View File

@ -0,0 +1,224 @@
This file contains the license for Orbot, a free software project to
provide anonymity on the Internet from a Google Android smartphone.
It also lists the licenses for other components used by Orbot, including
Tor, Privoxy, and iptables.
For more information about Orbot, see https://guardianproject.info/apps/orbot
If you got this file as a part of a larger bundle, there may be other
license terms that you should be aware of.
===============================================================================
Orbot is distributed under this license (aka the 3-clause BSD license)
Copyright (c) 2009-2010, Nathan Freitas, The Guardian Project
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the names of the copyright owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****
===============================================================================
Orbot includes the Obfs4 pluggable transport:
https://gitweb.torproject.org/pluggable-transports/obfs4.git
Copyright (c) 2014, Yawning Angel <yawning at torproject dot org>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
===============================================================================
*****
*****
Orbot contains a binary distribution of Privoxy (http://www.privoxy.org/)
Copyright © 2001-2010 by Privoxy Developers <ijbswa-developers@lists.sourceforge.net>
http://www.privoxy.org/user-manual/copyright.html
Some source code is based on code Copyright © 1997 by Anonymous Coders and Junkbusters, Inc.
and licensed under the GNU General Public License.
Privoxy is free software; you can redistribute it and/or modify it under the terms of the
GNU General Public License, version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for details.
http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
******
Orbot contains a binary distribution of Tor:
This file contains the license for Tor,
a free software project to provide anonymity on the Internet.
It also lists the licenses for other components used by Tor.
For more information about Tor, see https://www.torproject.org/.
If you got this file as a part of a larger bundle,
there may be other license terms that you should be aware of.
===============================================================================
Tor is distributed under this license:
Copyright (c) 2001-2004, Roger Dingledine
Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson
Copyright (c) 2007-2009, The Tor Project, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the names of the copyright owners nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
src/common/strlcat.c and src/common/strlcpy.c by Todd C. Miller are licensed
under the following license:
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================
If you got Tor as a static binary with OpenSSL included, then you should know:
"This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/)"
===============================================================================
===============================================================================
"This program uses the IP-to-Country Database provided by
WebHosting.Info (http://www.webhosting.info), available from
http://ip-to-country.webhosting.info."
See the src/config/geoip file in particular.
===============================================================================
===============================================================================
Orbot also uses iptables from the Netfilter.org project
netfilter/iptables is - like all of the Linux Kernel - Free Software (sometimes
referred to as Open Source Software), distributed under the terms of the GNU GPLv2
only. Please, note that some source code files might differ, and in that case it
is explicitely stated in the header of every file.
The GPL also contains some obligations. If you distribute netfilter/iptables code
in binary form, you have to offer the source code, too.
===============================================================================
===============================================================================
Orbot also includes BadVPN tun2socks: https://github.com/ambrop72/badvpn
Copyright (c) 2009, Ambroz Bizjak <ambrop7@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
===============================================================================

31
README Normal file
View File

@ -0,0 +1,31 @@
Orbot: Android Onion Routing Robot
***********************************************
Orbot is a freely licensed open-source application developed for the
Android platform. It acts as a front-end to the Tor binary application,
and also provides an HTTP Proxy for connecting web browsers and other
HTTP client applications into the Tor SOCKS interface.
***********************************************
Orbot is a component of the Guardian Project, an effort to develop
a secure, anonymous smartphone for use by human rights activists, journalists
and others around the world. Learn more: https://guardianproject.info/
***********************************************
Tor protects your privacy on the internet by hiding the connection
between your Internet address and the services you use. We believe Tor
is reasonably secure, but please ensure you read the instructions and
configure it properly. Learn more at https://torproject.org/
Tor Frequently Asked Questions:
https://support.torproject.org/faq/
***********************************************
/* Copyright (c) 2009-2013, Nathan Freitas, The Guardian Project
* https://guardianproject.info/ */
*****
Some icons thanks to:
https://drslash.com/flat-osx-pack/
FLAT OS by DrSlash.com is licensed under a Creative Commons Attribution NonCommercial 4.0 International License.

8
TODO Normal file
View File

@ -0,0 +1,8 @@
Current tracked tickets for Orbot can be found here:
https://trac.torproject.org/projects/tor/query?status=accepted&status=assigned&status=new&status=reopened&group=component&component=Orbot&order=priority
If you would like to join the project, we have some ideas for volunteering here:
http://www.torproject.org/getinvolved/volunteer.html.en#project-orbot
You can find us in IRC on FREENODE or OFTC in the #guardianproject and #tor-dev channels

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
apply from: 'variables.gradle'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'io.fabric'
ext {
@ -109,7 +109,7 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
@ -130,6 +130,7 @@ dependencies {
/*Firefox ABI Splits*/
implementation "org.mozilla.components:browser-engine-gecko:$mozilla_components_version"
implementation "org.mozilla.components:browser-icons:$mozilla_components_icon_version"
implementation "org.mozilla.geckoview:geckoview:$gecko_nightly_version"
/*Alert Dialog*/
@ -140,18 +141,19 @@ dependencies {
/*Crashlytics*/
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.flurry.android:analytics:12.4.0@aar'
/*View Animator*/
implementation 'com.daimajia.easing:library:2.1@aar'
implementation 'com.daimajia.androidanimations:library:2.3@aar'
implementation 'com.daimajia.easing:library:2.4@aar'
implementation 'com.daimajia.androidanimations:library:2.4@aar'
/*Orbot Service*/
implementation project(path: ':orbotservice')
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.github.apl-devs:appintro:v4.2.2'
/*Helper Libraries*/
implementation 'com.chauthai.overscroll:overscroll-bouncy:0.1.1'
}
apply plugin: 'com.android.application'

View File

@ -22,7 +22,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
android:usesCleartextTraffic="true"
tools:targetApi="n">
<!-- Activities -->
<activity
android:name="com.darkweb.genesissearchengine.appManager.orbotManager.orbotController"
@ -48,6 +49,7 @@
<activity
android:name="com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTop"
android:windowSoftInputMode="adjustResize" />
<activity
android:name="com.darkweb.genesissearchengine.appManager.tabManager.tabController"
@ -131,16 +133,13 @@
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-5074525529134731~2926711128" />
<service
android:name="com.darkweb.genesissearchengine.pluginManager.exitManager"
android:stopWithTask="false" />
<service
android:name="com.darkweb.genesissearchengine.helperManager.downloadFileService"
android:enabled="true"
android:exported="false"
android:stopWithTask="true" />
<service
android:name="org.torproject.android.service.TorService"
android:name="org.torproject.android.service.OrbotService"
android:enabled="true"
android:exported="false"
android:stopWithTask="true" />
@ -149,7 +148,8 @@
android:name="org.torproject.android.service.StartTorReceiver"
android:exported="true"
android:permission="TODO"
android:stopWithTask="true">
android:stopWithTask="true"
tools:ignore="ExportedReceiver">
<intent-filter>
<action android:name="org.torproject.android.intent.action.USER_PRESENT" />
</intent-filter>

View File

@ -0,0 +1 @@
../../../../LICENSE

View File

@ -0,0 +1 @@
//empty

View File

View File

View File

@ -183,8 +183,6 @@
<li>com.android.support : customtabs</li>
<li>com.android.support : design</li>
<li>android.arch.lifecycle : extensions</li>
<li>org.jetbrains.kotlin : kotlin-stdlib-jre7</li>
<li>org.jetbrains.kotlin : kotlin-stdlib</li>
<li>com.android.support : recyclerview-v7</li>
<li>android.arch.core : runtime</li>
<li>android.arch.lifecycle : runtime</li>

View File

@ -112,16 +112,16 @@ public class bookmarkAdapter extends RecyclerView.Adapter<bookmarkAdapter.listVi
void bindListView(bookmarkRowModel model) {
heaaderText = itemView.findViewById(R.id.mHeader);
descriptionText = itemView.findViewById(R.id.mDescription);
itemContainer = itemView.findViewById(R.id.item_container);
heaaderText = itemView.findViewById(R.id.p_header);
descriptionText = itemView.findViewById(R.id.p_description);
itemContainer = itemView.findViewById(R.id.p_item_container);
String header = model.getmHeader();
descriptionText.setText(model.getmHeader());
heaaderText.setText(model.getmDescription());
messageButton = itemView.findViewById(R.id.message_button);
empty_message = itemView.findViewById(R.id.empty_list);
// messageButton = itemView.findViewById(R.id.message_button);
empty_message = itemView.findViewById(R.id.p_empty_list);
setItemViewOnClickListener(itemContainer,header);
}

View File

@ -19,10 +19,13 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -64,10 +67,10 @@ public class bookmarkController extends AppCompatActivity
pluginController.getInstance().logEvent(strings.BOOKMARK_OPENED);
}
public void initializeViews(){
mEmptyListNotifier = findViewById(R.id.empty_list);
mSearchBar = findViewById(R.id.search);
mListView = findViewById(R.id.listview);
mClearButton = findViewById(R.id.clearButton);
mEmptyListNotifier = findViewById(R.id.p_empty_list);
mSearchBar = findViewById(R.id.p_search);
mListView = findViewById(R.id.p_listview);
mClearButton = findViewById(R.id.p_clearButton);
mBookmarkViewController = new bookmarkViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton,this);
mClearButton.setText(R.string.tab_view_clear_bookmark);
}
@ -131,7 +134,7 @@ public class bookmarkController extends AppCompatActivity
{
if(status.sIsAppPaused && (level==80 || level==15))
{
dataController.getInstance().setBool(keys.LOW_MEMORY,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
finish();
}
}
@ -156,7 +159,7 @@ public class bookmarkController extends AppCompatActivity
public class adapterCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.url_triggered)){
String url_temp = helperMethod.completeURL(data.get(0).toString());
@ -174,6 +177,7 @@ public class bookmarkController extends AppCompatActivity
else if(e_type.equals(enums.etype.remove_from_database)){
databaseController.getInstance().deleteFromList((int)data.get(0),"bookmark");
}
return null;
}
}

View File

@ -60,10 +60,6 @@ class bookmarkViewController
mEmptyListNotifier.animate().setDuration(duration).alpha(0f);
mClearButton.animate().setDuration(duration).alpha(1f);
}
else {
mEmptyListNotifier.animate().setDuration(duration).alpha(1f);
mClearButton.animate().setDuration(duration).alpha(0f);
}
}
void removeFromList(int index)

View File

@ -1,19 +1,14 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.Switch;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
@ -21,10 +16,10 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.Collections;
public class bridgeController extends AppCompatActivity {
@ -32,15 +27,13 @@ public class bridgeController extends AppCompatActivity {
/*Private Variables*/
private bridgeViewController mBridgeViewController;
private Switch mAutoSwitch;
private Switch mManualSwitch;
private EditText mCustomBridgeInput1;
private RadioButton mObs4Proxy;
private RadioButton mMeekProxy;
private LinearLayout mTopPanel;
private LinearLayout mBottomPanel;
private Button mBridgeRequestButton;
private bridgeViewController m_bridge_view_controller;
private RadioButton m_bridge_obfs;
private RadioButton m_bridge_china;
private RadioButton m_bridge_custom;
private EditText m_custom_port;
private Button m_bridge_button;
private ImageView m_custom_bridge_blocker;
/*Initializations*/
@Override
@ -56,75 +49,38 @@ public class bridgeController extends AppCompatActivity {
public void initializeAppModel()
{
mBridgeViewController = new bridgeViewController();
m_bridge_view_controller = new bridgeViewController();
}
public void initializeConnections()
{
mAutoSwitch = findViewById(R.id.bridgeSwitchAuto);
mManualSwitch = findViewById(R.id.bridgeSwitchManual);
mObs4Proxy = findViewById(R.id.bridge_obfs);
mMeekProxy = findViewById(R.id.bridge_china);
mTopPanel = findViewById(R.id.topPanel);
mBottomPanel = findViewById(R.id.bottomPanel);
mCustomBridgeInput1 = findViewById(R.id.port1);
mBridgeRequestButton = findViewById(R.id.bridgeButton);
m_bridge_obfs = findViewById(R.id.p_bridge_obfs);
m_bridge_china = findViewById(R.id.p_bridge_china);
m_custom_port = findViewById(R.id.p_port_1);
m_bridge_button = findViewById(R.id.p_bridge_button);
m_bridge_custom = findViewById(R.id.p_custom_bridge);
m_custom_bridge_blocker = findViewById(R.id.p_custom_bridge_blocker);
mBridgeViewController.initialization(mAutoSwitch,mManualSwitch,mCustomBridgeInput1,this,mObs4Proxy,mMeekProxy,mTopPanel,mBottomPanel,mBridgeRequestButton);
m_bridge_view_controller.initialization(m_custom_port, m_bridge_button,this, m_bridge_obfs, m_bridge_china, m_bridge_custom, m_custom_bridge_blocker);
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,0));
}
private void initializeLocalEventHandlers()
{
mAutoSwitch.setOnClickListener(view ->
{
boolean isChecked = mAutoSwitch.isChecked();
status.sGatewayAuto = isChecked;
dataController.getInstance().setBool(keys.GATEWAY_AUTO, isChecked);
dataController.getInstance().setBool(keys.GATEWAY_MANUAL, !isChecked);
if (isChecked)
{
mBridgeViewController.setBridgeState(false, isChecked);
status.sGatewayManual = false;
} else
{
mBridgeViewController.setBridgeState(false, false);
}
});
mManualSwitch.setOnClickListener(view ->
{
boolean isChecked = mManualSwitch.isChecked();
status.sGatewayManual = isChecked;
dataController.getInstance().setBool(keys.GATEWAY_MANUAL, isChecked);
dataController.getInstance().setBool(keys.GATEWAY_AUTO, !isChecked);
if (isChecked)
{
mBridgeViewController.setBridgeState(isChecked, false);
status.sGatewayAuto = false;
} else
{
mBridgeViewController.setBridgeState(false, false);
}
});
mCustomBridgeInput1.addTextChangedListener(new TextWatcher() {
m_custom_port.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2)
{
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2)
{
}
@Override
public void afterTextChanged(Editable editable) {
status.sCustomBridge=mCustomBridgeInput1.getText().toString();
status.sCustomBridge= m_custom_port.getText().toString();
}
});
}
@ -134,9 +90,9 @@ public class bridgeController extends AppCompatActivity {
{
super.onPause();
if(dataController.getInstance()!=null){
dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge);
dataController.getInstance().setBool(keys.GATEWAY_AUTO,status.sGatewayAuto);
dataController.getInstance().setBool(keys.GATEWAY_MANUAL,status.sGatewayManual);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.GATEWAY_AUTO,status.sGatewayAuto));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.GATEWAY_MANUAL,status.sGatewayManual));
}
}
@ -162,12 +118,20 @@ public class bridgeController extends AppCompatActivity {
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(constants.BACKEND_GOOGLE_URL), enums.etype.on_bridge_mail);
}
public void onCustomChecked(View view){
status.sCustomBridge = strings.CUSTOM_BRIDGE_CUSTOM;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
}
public void onMeekChecked(View view){
status.sCustomBridge = "meek";
dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge);
status.sCustomBridge = strings.CUSTOM_BRIDGE_OBFS4;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
}
public void onObfsChecked(View view){
status.sCustomBridge = "obfs4";
dataController.getInstance().setString(keys.CUSTOM_BRIDGE_1,status.sCustomBridge);
status.sCustomBridge = strings.CUSTOM_BRIDGE_MEEK;
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,status.sCustomBridge));
m_bridge_view_controller.onTrigger(bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS, Arrays.asList(status.sCustomBridge,250));
}
}

View File

@ -0,0 +1,9 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
public class bridgeEnums
{
/*Settings Manager*/
public enum eBridgeViewCommands {
M_INIT_VIEWS
}
}

View File

@ -1,129 +1,127 @@
package com.darkweb.genesissearchengine.appManager.bridgeManager;
import android.animation.ValueAnimator;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.List;
class bridgeViewController
{
/*Private Variables*/
private Switch mAutoSwitch;
private Switch mManualSwitch;
private EditText mCustomBridgeInput1;
private RadioButton mObs4Proxy;
private RadioButton mMeekProxy;
private Button mBridgeRequestButton;
private LinearLayout mTopPanel;
private LinearLayout mBottomPanel;
private RadioButton m_bridge_obfs;
private RadioButton m_bridge_china;
private RadioButton m_bridge_custom;
private Button m_bridge_button;
private EditText m_custom_port;
private ImageView m_custom_bridge_blocker;
/*ViewControllers*/
private int mPanelHeight = 0;
private AppCompatActivity mContext;
private AppCompatActivity m_context;
/*Initializations*/
void initialization(Switch mAutoSwitch,Switch mManualSwitch,EditText mCustomBridgeInput1,AppCompatActivity mContext,RadioButton mObs4Proxy,RadioButton mMeekProxy,LinearLayout mTopPanel,LinearLayout mBottomPanel,Button mBridgeRequestButton){
this.mContext = mContext;
this.mAutoSwitch = mAutoSwitch;
this.mManualSwitch = mManualSwitch;
this.mCustomBridgeInput1 = mCustomBridgeInput1;
this.mObs4Proxy = mObs4Proxy;
this.mMeekProxy = mMeekProxy;
this.mTopPanel = mTopPanel;
this.mBottomPanel = mBottomPanel;
this.mBridgeRequestButton = mBridgeRequestButton;
void initialization(EditText p_custom_port, Button p_bridge_button, AppCompatActivity p_context,RadioButton p_bridge_obfs,RadioButton p_bridge_china,RadioButton p_bridge_custom, ImageView p_custom_bridge_blocker){
this.m_context = p_context;
this.m_bridge_obfs = p_bridge_obfs;
this.m_bridge_china = p_bridge_china;
this.m_bridge_custom = p_bridge_custom;
this.m_bridge_button = p_bridge_button;
this.m_custom_port = p_custom_port;
this.m_custom_bridge_blocker = p_custom_bridge_blocker;
initPostUI();
initViews();
initPanels();
}
private void initPostUI(){
mPanelHeight = 1000;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
Window window = m_context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
}
else {
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
}
}
}
private void initViews(){
mAutoSwitch.setChecked(status.sGatewayAuto);
mManualSwitch.setChecked(status.sGatewayManual);
private void animateColor(TextView p_view, int p_from, int p_to, String p_command, int p_duration){
ObjectAnimator colorAnim = ObjectAnimator.ofInt(p_view, p_command,p_from, p_to);
colorAnim.setEvaluator(new ArgbEvaluator());
colorAnim.setDuration(p_duration);
colorAnim.start();
}
mMeekProxy.clearFocus();
mObs4Proxy.clearFocus();
private void resetRadioButtons(int p_duration){
animateColor(m_bridge_obfs, m_bridge_obfs.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
animateColor(m_bridge_custom, m_bridge_custom.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
animateColor(m_bridge_china, m_bridge_china.getCurrentTextColor(), m_context.getResources().getColor(R.color.float_white), "textColor", p_duration);
if(status.sGatewayAuto){
if(status.sCustomBridge.contains("obfs")){
mObs4Proxy.setChecked(true);
}else {
mMeekProxy.setChecked(true);
m_bridge_obfs.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
m_bridge_custom.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
m_bridge_china.setHighlightColor(m_context.getResources().getColor(R.color.float_white));
m_bridge_obfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
m_bridge_custom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
m_bridge_china.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.float_white)));
helperMethod.hideKeyboard(m_context);
m_custom_port.clearFocus();
m_custom_port.animate().setDuration(p_duration).alpha(0.2f);
m_bridge_button.animate().setDuration(p_duration).alpha(0.2f);
m_custom_bridge_blocker.setVisibility(View.VISIBLE);
}
setBridgeState(false,true);
}
else if(status.sGatewayManual){
mCustomBridgeInput1.setText(status.sCustomBridge);
setBridgeState(true,false);
}
else {
setBridgeState(false,false);
private void initViews(String p_bridge, int p_duration){
resetRadioButtons(p_duration);
switch (p_bridge) {
case strings.CUSTOM_BRIDGE_OBFS4:
animateColor(m_bridge_china, m_bridge_china.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
m_bridge_china.setHighlightColor(Color.BLACK);
m_bridge_china.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
m_bridge_china.setChecked(true);
break;
case strings.CUSTOM_BRIDGE_MEEK:
animateColor(m_bridge_obfs, m_bridge_obfs.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
m_bridge_obfs.setHighlightColor(Color.BLACK);
m_bridge_obfs.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
m_bridge_obfs.setChecked(true);
break;
case strings.CUSTOM_BRIDGE_CUSTOM:
animateColor(m_bridge_custom, m_bridge_custom.getCurrentTextColor(), m_context.getResources().getColor(R.color.black), "textColor", p_duration);
m_bridge_custom.setHighlightColor(Color.BLACK);
m_bridge_custom.setButtonTintList(ColorStateList.valueOf(ContextCompat.getColor(m_context, R.color.cursor_blue)));
m_bridge_custom.setChecked(true);
m_custom_port.animate().setDuration(p_duration).alpha(1f);
m_bridge_button.animate().setDuration(p_duration).alpha(1f);
m_custom_bridge_blocker.setVisibility(View.GONE);
break;
}
}
void setBridgeState(boolean manual, boolean auto){
mAutoSwitch.setChecked(auto);
mManualSwitch.setChecked(manual);
if(auto){
mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(true)));
mBottomPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mBottomPanel.setClickable(false)));
mCustomBridgeInput1.setEnabled(false);
mMeekProxy.setEnabled(true);
mObs4Proxy.setEnabled(true);
mBridgeRequestButton.setEnabled(false);
public void onTrigger(bridgeEnums.eBridgeViewCommands p_commands, List<Object> p_data){
if(p_commands == bridgeEnums.eBridgeViewCommands.M_INIT_VIEWS){
initViews((String) p_data.get(0), (int)p_data.get(1));
}
if(manual){
mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(false)));
mBottomPanel.animate().setDuration(300).alpha(1).withEndAction((() -> mBottomPanel.setClickable(true)));
mCustomBridgeInput1.setEnabled(true);
mMeekProxy.setEnabled(false);
mObs4Proxy.setEnabled(false);
mBridgeRequestButton.setEnabled(true);
}
if(!auto && !manual) {
mTopPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mTopPanel.setClickable(false)));
mBottomPanel.animate().setDuration(300).alpha(0.55f).withEndAction((() -> mBottomPanel.setClickable(false)));
mCustomBridgeInput1.setEnabled(false);
mMeekProxy.setEnabled(false);
mObs4Proxy.setEnabled(false);
mBridgeRequestButton.setEnabled(false);
}
}
private void initPanels(){
}
}

View File

@ -7,7 +7,12 @@ import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.constants.constants;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import static android.content.Context.MODE_PRIVATE;
public class databaseController
@ -66,12 +71,22 @@ public class databaseController
public ArrayList<historyRowModel> selectHistory(int startIndex,int endIndex){
ArrayList<historyRowModel> tempmodel = new ArrayList<>();
Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date DESC LIMIT "+endIndex+" OFFSET "+startIndex, null);
Cursor c = mDatabaseInstance.rawQuery("SELECT * FROM history ORDER BY date ASC LIMIT "+endIndex+" OFFSET "+startIndex, null);
if (c.moveToFirst()){
do {
historyRowModel model = new historyRowModel(c.getString(2), c.getString(1),Integer.parseInt(c.getString(0)));
historyRowModel model = new historyRowModel(c.getString(3), c.getString(2),Integer.parseInt(c.getString(0)));
try {
Date m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US).parse(c.getString(1));
model.setDate(m_date);
} catch (Exception e) {
e.printStackTrace();
}
if(Calendar.getInstance().getTime().getTime() < model.getDate().getTime()){
tempmodel.add(model);
model.updateTitle(c.getString(3));
}else {
tempmodel.add(0, model);
}
} while(c.moveToNext());
}
c.close();
@ -87,9 +102,9 @@ public class databaseController
do {
if(c.getString(0)==null){
break;
}
}else {
id = Integer.parseInt(c.getString(0));
break;
}
} while(c.moveToNext());
}
c.close();

View File

@ -1,40 +1,211 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.widget.*;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listViewHolder>
{
/*Private Variables*/
private ArrayList<historyRowModel> mModelList;
private ArrayList<historyRowModel> mModelList = new ArrayList<>();
private ArrayList<historyRowModel> tempModelList;
private ArrayList<historyRowModel> passedModelList;
private ArrayList<Integer> m_real_id = new ArrayList<>();
private ArrayList<Integer> m_real_index = new ArrayList<>();
private ArrayList<String> m_long_selected = new ArrayList<>();
private ArrayList<Integer> m_long_selected_id = new ArrayList<>();
private PopupWindow popupWindow = null;
private eventObserver.eventListener mEvent;
private String filter = strings.EMPTY_STR;
private boolean isClosing = false;
private AppCompatActivity m_main_context;
private ArrayList<View> m_long_pressed_list_view_holder = new ArrayList<>();
historyAdapter(ArrayList<historyRowModel> mModelList, eventObserver.eventListener mEvent) {
this.mModelList = mModelList;
/*Local Variables*/
private float x1,x2;
private String filter = strings.EMPTY_STR;
static final int MIN_DISTANCE = 150;
private boolean isClosing = false;
boolean m_was_long_pressed = false;
historyAdapter(ArrayList<historyRowModel> p_model_list, eventObserver.eventListener mEvent, AppCompatActivity p_main_context) {
this.mEvent = mEvent;
tempModelList = new ArrayList<>();
passedModelList = p_model_list;
m_main_context = p_main_context;
initializeModelWithDate(false);
}
public void onLoading(){
m_main_context.runOnUiThread(() -> {
tempModelList.add(new historyRowModel("loading",null,-2));
notifyItemInserted(tempModelList.size());
});
}
public void onLoadingClear(){
for(int m_counter=0;m_counter<tempModelList.size();m_counter++){
if(tempModelList.get(m_counter).getHeader().equals("loading")){
int finalM_counter = m_counter;
m_main_context.runOnUiThread(() -> {
tempModelList.remove(finalM_counter);
notifyItemRemoved(finalM_counter +1);
});
break;
}
}
}
public void initializeModelWithDate(boolean p_filter_enabled){
int m_real_counter=0;
m_real_id.clear();
m_real_index.clear();
tempModelList.clear();
this.mModelList.clear();
onVerifyLongSelectedURL();
ArrayList<historyRowModel> p_model_list = passedModelList;
int m_date_state = -1;
int m_last_day = -1;
for(int counter = 0; counter< p_model_list.size(); counter++){
if(p_filter_enabled){
if(!p_model_list.get(counter).getHeader().toLowerCase().contains(this.filter.toLowerCase()) && !p_model_list.get(counter).getDescription().toLowerCase().contains(this.filter)){
continue;
}
}
Calendar cal = Calendar.getInstance();
cal.setTime(p_model_list.get(counter).getDate());
int m_date_1 = cal.get(Calendar.DAY_OF_YEAR);
cal.setTime(Calendar.getInstance().getTime());
int m_date_2 = cal.get(Calendar.DAY_OF_YEAR);
float diff = m_date_2-m_date_1;
float days = diff / (24 * 60 * 60 * 1000);
if(diff==0){
if(m_date_state!=1){
this.mModelList.add(new historyRowModel("Today ",null,-1));
}
m_real_id.add(m_real_counter);
m_real_index.add(m_real_counter);
m_date_state = 1;
}else if (diff>=1){
if(m_date_state!=2 || m_last_day!=(int)(Math.ceil(days/7)*7)){
m_last_day = (int)(Math.ceil(days/7)*7);
this.mModelList.add(new historyRowModel("Last " + m_last_day + " Days",null,-1));
}
m_real_id.add(m_real_counter);
m_real_index.add(m_real_counter);
m_date_state = 2;
}else {
if(m_date_state!=3){
this.mModelList.add(new historyRowModel("Older ",null,-1));
}
m_real_id.add(m_real_counter);
m_real_index.add(m_real_counter);
m_date_state = 3;
}
m_real_id.add(p_model_list.get(counter).getID());
m_real_index.add(m_real_counter);
this.mModelList.add(p_model_list.get(counter));
m_real_counter+=1;
}
tempModelList.addAll(this.mModelList);
}
/*Initializations*/
public ArrayList<String> getLongSelectedleURL(){
return m_long_selected;
}
public void onDeleteSelected(){
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
for(int m_counter_inner=0;m_counter_inner<passedModelList.size();m_counter_inner++){
if(m_long_selected.get(m_counter).equals("https://"+passedModelList.get(m_counter_inner).getDescription())){
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.url_clear);
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.url_clear_at);
invokeFilter(false);
mEvent.invokeObserver(Collections.singletonList(m_counter_inner),enums.etype.is_empty);
initializeModelWithDate(false);
if(m_counter_inner==0){
notifyDataSetChanged();
}else {
notifyItemRemoved(m_counter_inner+1);
notifyItemRangeChanged(m_counter_inner+1, passedModelList.size());
}
break;
}
}
}
clearLongSelectedURL();
}
public void clearLongSelectedURL(){
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
View m_item_view = m_long_pressed_list_view_holder.get(m_counter);
ImageButton m_popup_menu = m_item_view.findViewById(R.id.p_popup_menu);
ImageView p_logo_image = m_item_view.findViewById(R.id.p_logo_image);
m_item_view.setPressed(false);
m_popup_menu.setVisibility(View.VISIBLE);
m_popup_menu.animate().setDuration(150).alpha(1);
m_popup_menu.setClickable(true);
p_logo_image.setAlpha(1f);
p_logo_image.animate().cancel();
p_logo_image.animate().setDuration(150).alpha(0).withEndAction(() -> p_logo_image.setVisibility(View.GONE));
}
m_long_selected.clear();
m_long_selected_id.clear();
m_long_pressed_list_view_holder.clear();
}
public String getSelectedURL(){
String m_joined_url = "\n";
for(int m_counter=0;m_counter<m_long_selected.size();m_counter++){
m_joined_url = m_joined_url.concat("\n"+m_long_selected.get(m_counter));
}
return m_joined_url;
}
Context m_context;
@NonNull
@Override
public listViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
m_context = parent.getContext();
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_row_view, parent, false);
return new listViewHolder(view);
}
@ -42,8 +213,11 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
@Override
public void onBindViewHolder(@NonNull historyAdapter.listViewHolder holder, int position)
{
holder.bindListView(tempModelList.get(position));
clearMessageItem(holder.mMessageButton,position);
holder.bindListView(tempModelList.get(position), position);
}
public int getItem(){
return tempModelList.size();
}
@Override
@ -52,27 +226,246 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}
/*Listeners*/
private void setItemViewOnClickListener(View itemView, String url)
{
itemView.setOnClickListener(v -> mEvent.invokeObserver(Collections.singletonList(url),enums.etype.url_triggered));
boolean m_is_searched = false;
public void onUpdateSearchStatus(boolean p_is_searched){
m_is_searched = !p_is_searched;
}
private void clearMessageItem(ImageButton clearButton, int index)
public void onSelectView(View p_item, View itemView, int p_poisition, String p_url, View p_menu_item, TextView p_logo_text, ImageView p_logo_image, boolean p_is_forced, int p_id){
if(!m_is_searched){
try {
itemView.setPressed(false);
int speed = 150;
if(p_is_forced){
speed=0;
}
p_menu_item.animate().setDuration(speed).alpha(0).withEndAction(() -> {
p_menu_item.setVisibility(View.INVISIBLE);
p_menu_item.setClickable(false);
});
p_logo_image.setAlpha(0.5f);
p_logo_image.setVisibility(View.VISIBLE);
p_logo_image.animate().cancel();
p_logo_image.animate().setDuration(speed).alpha(1);
} catch (Exception e) {
e.printStackTrace();
}
if(!p_is_forced){
m_long_selected.add(p_url);
m_long_selected_id.add(p_id);
m_long_pressed_list_view_holder.add(p_item);
}
onVerifyLongSelectedURL();
}
}
public void onVerifyLongSelectedURL(){
if(m_long_selected.size()>0){
mEvent.invokeObserver(Collections.singletonList(false),enums.etype.on_verify_selected_url_menu);
}else {
mEvent.invokeObserver(Collections.singletonList(true),enums.etype.on_verify_selected_url_menu);
}
}
public void onClearHighlight(View p_item, View itemView, int p_poisition, String p_url, View p_menu_item,TextView p_logo_text,ImageView p_logo_image,boolean p_is_forced, int p_id)
{
clearButton.setOnClickListener(v ->
try {
itemView.setPressed(false);
p_menu_item.setVisibility(View.VISIBLE);
int speed = 150;
if(p_is_forced){
speed = 0;
}
p_menu_item.animate().setDuration(speed).alpha(1);
p_menu_item.setClickable(true);
p_logo_image.setAlpha(1f);
p_logo_image.animate().cancel();
p_logo_image.animate().setDuration(speed).alpha(0).withEndAction(() -> p_logo_image.setVisibility(View.GONE));
m_long_selected.remove(p_url);
m_long_selected_id.remove((Integer) p_id);
m_long_pressed_list_view_holder.remove(p_item);
onVerifyLongSelectedURL();
} catch (Exception e) {
e.printStackTrace();
}
}
int m_list_initial_size = 0;
@SuppressLint("ClickableViewAccessibility")
public void onSwipe(View p_item, View p_item_view, int p_position, String p_url, View p_menu_item,TextView p_logo_text,ImageView p_logo_image, int p_id){
Handler handler = new Handler();
Runnable mLongPressed = () -> {
if(!m_disable_callable){
if(!m_long_selected.contains(p_url) || !m_long_selected_id.contains(p_id)) {
m_was_long_pressed = true;
onSelectView(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, false, p_id);
}else {
onClearHighlight(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, false, p_id);
m_was_long_pressed = true;
}
}
};
p_item_view.setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_UP) {
if(m_long_selected.size()>0){
if(m_long_selected.contains(p_url) && m_long_selected_id.contains(p_id)){
handler.removeCallbacks(mLongPressed);
if(!m_was_long_pressed){
onClearHighlight(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image,false, p_id);
}
return false;
}else if(!m_was_long_pressed){
handler.removeCallbacks(mLongPressed);
onSelectView(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image,false, p_id);
}
return false;
}
else if(m_list_initial_size>0){
return false;
}
x2 = event.getX();
float deltaX = x2 - x1;
if (Math.abs(deltaX) > MIN_DISTANCE)
{
v.setPressed(false);
onClose(p_position);
}
else
{
v.setPressed(false);
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered);
}
return true;
}
else if (event.getAction() == MotionEvent.ACTION_DOWN) {
m_disable_callable = false;
m_list_initial_size = m_long_selected.size();
m_was_long_pressed = false;
v.setPressed(true);
x1 = event.getX();
handler.postDelayed(mLongPressed, ViewConfiguration.getLongPressTimeout());
return true;
}
else if(event.getAction() == MotionEvent.ACTION_CANCEL)
{
m_disable_callable = true;
if(!m_long_selected.contains(p_url) || !m_long_selected_id.contains(p_id)) {
v.setPressed(false);
}
return true;
}
return false;
});
}
void onOpenMenu(View view, String p_url, int p_position, String p_title){
if(popupWindow!=null){
popupWindow.dismiss();
}
LayoutInflater layoutInflater
= (LayoutInflater) view.getContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
final View popupView = layoutInflater.inflate(R.layout.history_popup_menu, null);
this.popupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
view.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
int xOffset = -(view.getMeasuredWidth() - view.getWidth());
int[] location = new int[2];
view.getLocationOnScreen(location);
int y = location[1] + 600;
int height = helperMethod.getScreenHeight(m_main_context);
int m_offset_height = 0;
if(y + 400 >height){
m_offset_height = y-height;
}
else if(y - 1200 < 0){
m_offset_height = y - 1200;
}
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
popupWindow.setAnimationStyle(R.style.popup_window_animation);
popupWindow.setElevation(7);
popupWindow.showAsDropDown(view,xOffset - 90,-330 - m_offset_height);
setPopupWindowEvents(popupView.findViewById(R.id.menu1), p_url, p_position, p_title);
setPopupWindowEvents(popupView.findViewById(R.id.menu2), p_url, p_position, p_title);
setPopupWindowEvents(popupView.findViewById(R.id.menu3), p_url, p_position, p_title);
setPopupWindowEvents(popupView.findViewById(R.id.menu4), p_url, p_position, p_title);
setPopupWindowEvents(popupView.findViewById(R.id.menu5), p_url, p_position, p_title);
}
public void setPopupWindowEvents(View p_view, String p_url, int p_position, String p_title){
p_view.setOnClickListener(v -> {
if(v.getId() == R.id.menu1){
helperMethod.copyURL(p_url, m_context);
popupWindow.dismiss();
}
else if(v.getId() == R.id.menu2){
helperMethod.shareApp((AppCompatActivity)m_context, p_url, p_title);
popupWindow.dismiss();
}
else if(v.getId() == R.id.menu3){
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered);
popupWindow.dismiss();
}
else if(v.getId() == R.id.menu4){
mEvent.invokeObserver(Collections.singletonList(p_url),enums.etype.url_triggered_new_tab);
popupWindow.dismiss();
}
else if(v.getId() == R.id.menu5){
onClose(p_position);
popupWindow.dismiss();
}
});
}
private void setItemViewOnClickListener(View p_item, View p_item_view, View p_item_menu , String p_url, int p_position, String p_title,View p_menu_item,TextView p_logo_text,ImageView p_logo_image, int p_id)
{
p_item_menu.setOnClickListener((View v) -> onOpenMenu(v, p_url, p_position, p_title));
onSwipe(p_item, p_item_view, p_position, p_url,p_menu_item, p_logo_text, p_logo_image, p_id);
}
boolean m_disable_callable = false;
public void onClose(int index){
if(!isClosing){
isClosing = true;
int size = mModelList.size();
int index_temp = tempModelList.get(index).getmId();
mEvent.invokeObserver(Collections.singletonList(tempModelList.get(index).getmHeader()),enums.etype.url_clear_at);
mEvent.invokeObserver(Collections.singletonList(mModelList.get(index_temp).getmId()),enums.etype.remove_from_database);
mEvent.invokeObserver(Collections.singletonList(tempModelList.get(index).getmId()),enums.etype.url_clear);
mEvent.invokeObserver(Collections.singletonList(m_real_index.get(index)),enums.etype.url_clear);
mEvent.invokeObserver(Collections.singletonList(m_real_id.get(index)),enums.etype.url_clear_at);
invokeFilter(false);
mEvent.invokeObserver(Collections.singletonList(index),enums.etype.is_empty);
mEvent.invokeObserver(Collections.singletonList(m_real_id.get(index)),enums.etype.is_empty);
if(passedModelList.size()>0){
initializeModelWithDate(false);
}else {
tempModelList.clear();
index=0;
}
int size = tempModelList.size();
notifyItemRemoved(index);
notifyItemRangeChanged(index, size);
if(size>1){
new Thread(){
public void run(){
@ -89,54 +482,87 @@ public class historyAdapter extends RecyclerView.Adapter<historyAdapter.listView
}.start();
}
}
});
}
/*View Holder Extensions*/
class listViewHolder extends RecyclerView.ViewHolder
{
TextView mHeaaderText;
TextView mDescriptionText;
ImageButton mMessageButton;
ImageView mEmptyMessage;
LinearLayout mItemContainer;
TextView m_header;
TextView m_description;
TextView m_date;
TextView m_logo_default;
ImageButton m_popup_menu;
ImageView p_logo_image;
LinearLayout m_item_container;
LinearLayout m_date_container;
LinearLayout m_loading;
listViewHolder(View itemView) {
super(itemView);
}
void bindListView(historyRowModel model) {
void bindListView(historyRowModel model, int p_position) {
m_date_container = itemView.findViewById(R.id.p_date_container);
m_header = itemView.findViewById(R.id.p_header);
m_description = itemView.findViewById(R.id.p_description);
m_item_container = itemView.findViewById(R.id.p_item_container);
m_popup_menu = itemView.findViewById(R.id.p_popup_menu);
m_date = itemView.findViewById(R.id.p_date);
p_logo_image = itemView.findViewById(R.id.p_logo_image);
m_logo_default = itemView.findViewById(R.id.p_logo_default);
m_loading = itemView.findViewById(R.id.p_loading);
mHeaaderText = itemView.findViewById(R.id.mHeader);
mDescriptionText = itemView.findViewById(R.id.mDescription);
mItemContainer = itemView.findViewById(R.id.item_container);
String header = model.getmHeader();
if(model.getID() == -1){
m_date.setText(model.getHeader());
m_date_container.setVisibility(View.VISIBLE);
m_item_container.setVisibility(View.GONE);
m_popup_menu.setVisibility(View.GONE);
m_logo_default.setVisibility(View.GONE);
m_loading.setVisibility(View.GONE);
}
else if(model.getID() == -2){
m_date.setText(model.getHeader());
m_date_container.setVisibility(View.GONE);
m_item_container.setVisibility(View.GONE);
m_popup_menu.setVisibility(View.GONE);
m_logo_default.setVisibility(View.GONE);
m_loading.setVisibility(View.VISIBLE);
}
else {
m_date_container.setVisibility(View.GONE);
m_loading.setVisibility(View.GONE);
m_item_container.setVisibility(View.VISIBLE);
m_popup_menu.setVisibility(View.VISIBLE);
m_logo_default.setVisibility(View.VISIBLE);
mDescriptionText.setText(model.getmDescription());
mHeaaderText.setText(model.getmHeader());
mMessageButton = itemView.findViewById(R.id.message_button);
mEmptyMessage = itemView.findViewById(R.id.empty_list);
m_logo_default.setText((model.getHeader().toUpperCase().charAt(0)+""));
String header = model.getHeader();
m_description.setText(("https://"+model.getDescription()));
m_header.setText(model.getHeader());
setItemViewOnClickListener(mItemContainer, header);
setItemViewOnClickListener(itemView, m_item_container, m_popup_menu, m_description.getText().toString(), p_position, header, m_popup_menu, m_logo_default, p_logo_image, model.getID());
}
if(m_long_selected.contains("https://" + model.getDescription()) && m_long_selected_id.contains(model.getID())){
onSelectView(itemView, m_item_container, p_position, model.getDescription(), m_popup_menu, m_logo_default, p_logo_image,true, model.getID());
}else if(m_popup_menu.isClickable()){
onClearHighlight(itemView, m_item_container, p_position, model.getDescription(), m_popup_menu, m_logo_default, p_logo_image,true, model.getID());
}
}
}
void setFilter(String filter){
this.filter = filter;
this.filter = filter.toLowerCase();
}
void invokeFilter(boolean notify){
tempModelList.clear();
for(int counter = 0; counter< mModelList.size(); counter++){
if(mModelList.get(counter).getmHeader().contains(filter)){
historyRowModel model = mModelList.get(counter);
tempModelList.add(new historyRowModel(model.getmHeader(),model.getmDescription(),counter));
}
}
if(notify){
if(filter.length()>0){
initializeModelWithDate(true);
}else {
initializeModelWithDate(false);
}
notifyDataSetChanged();
}
}

View File

@ -1,13 +1,18 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
import android.content.Context;
import android.graphics.Rect;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
@ -17,34 +22,41 @@ import com.darkweb.genesissearchengine.appManager.databaseManager.databaseContro
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.sql;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static com.darkweb.genesissearchengine.appManager.historyManager.historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU;
public class historyController extends AppCompatActivity
{
/*Private Variables*/
private historyModel mListModel;
private homeController mHomeController;
private activityContextManager mContextManager;
private historyModel m_list_model;
private homeController m_home_controller;
private activityContextManager m_context_manager;
private ImageView mEmptyListNotifier;
private EditText mSearchBar;
private RecyclerView mListView;
private Button mClearButton;
private ImageButton mMoreButton;
/*Private Views*/
private historyViewController mHistoryViewController;
private ImageView m_empty_list;
private EditText m_search;
private RecyclerView m_listview;
private Button m_clearButton;
private ImageButton m_menu_button;
private ImageButton m_search_button;
private historyViewController m_history_view_controller;
/*Initializations*/
@ -60,36 +72,81 @@ public class historyController extends AppCompatActivity
}
public void initializeListModel(){
mListModel = new historyModel();
mContextManager = activityContextManager.getInstance();
mHomeController = activityContextManager.getInstance().getHomeController();
mContextManager.setHistoryController(this);
m_list_model = new historyModel();
m_context_manager = activityContextManager.getInstance();
m_home_controller = activityContextManager.getInstance().getHomeController();
m_context_manager.setHistoryController(this);
activityContextManager.getInstance().setHistoryController(this);
pluginController.getInstance().logEvent(strings.HISTORY_OPENED);
}
public void initializeViews(){
mEmptyListNotifier = findViewById(R.id.empty_list);
mSearchBar = findViewById(R.id.search);
mListView = findViewById(R.id.listview);
mClearButton = findViewById(R.id.clearButton);
mMoreButton = findViewById(R.id.load_more);
mHistoryViewController = new historyViewController(mEmptyListNotifier, mSearchBar, mListView, mClearButton, mMoreButton,this);
m_empty_list = findViewById(R.id.p_empty_list);
m_search = findViewById(R.id.p_search);
m_listview = findViewById(R.id.p_listview);
m_clearButton = findViewById(R.id.p_clearButton);
m_menu_button = findViewById(R.id.p_menu_button);
m_search_button = findViewById(R.id.p_search_button);
m_history_view_controller = new historyViewController(m_empty_list, m_search, m_listview, m_clearButton,this, m_menu_button, m_search_button);
}
public void initializeList(){
ArrayList<historyRowModel> model = dataController.getInstance().getHistory();
mListModel.setList(model);
historyAdapter adapter = new historyAdapter(mListModel.getList(),new adapterCallback());
ArrayList<historyRowModel> model = (ArrayList<historyRowModel>) dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_GET_HISTORY ,null);
m_list_model.setList(model);
historyAdapter adapter = new historyAdapter(m_list_model.getList(),new adapterCallback(), this);
adapter.invokeFilter(false);
mListView.setAdapter(adapter);
mListView.setLayoutManager(new LinearLayoutManager(this));
mHistoryViewController.updateIfListEmpty(mListModel.getList().size(),0);
m_listview.setAdapter(adapter);
m_listview.setLayoutManager(new LinearLayoutManager(this));
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(m_list_model.getList().size(),0));
}
/*View Handlers*/
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
View v = getCurrentFocus();
if ( v instanceof EditText) {
Rect outRect = new Rect();
v.getGlobalVisibleRect(outRect);
if (!outRect.contains((int)event.getRawX(), (int)event.getRawY())) {
v.clearFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
}
}
}
return super.dispatchTouchEvent(event);
}
boolean m_is_recyclerview_loading = false;
public void onEditorInvoked(){
mSearchBar.setOnEditorActionListener((v, actionId, event) ->{
m_listview.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (!recyclerView.canScrollVertically(1)) {
if(m_search.getVisibility()==View.GONE){
LinearLayoutManager layoutManager=LinearLayoutManager.class.cast(recyclerView.getLayoutManager());
int totalItemCount = layoutManager.getItemCount();
int lastVisible = layoutManager.findLastVisibleItemPosition();
boolean endHasBeenReached = lastVisible + 2 >= totalItemCount;
if (totalItemCount > 0 && endHasBeenReached && !m_is_recyclerview_loading) {
loadMore();
}
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
}
});
m_clearButton.requestFocusFromTouch();
m_clearButton.setOnClickListener(v -> pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHistoryController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.clear_history));
m_search.setOnEditorActionListener((v, actionId, event) ->{
if (actionId == EditorInfo.IME_ACTION_NEXT)
{
helperMethod.hideKeyboard(this);
@ -98,7 +155,16 @@ public class historyController extends AppCompatActivity
return false;
});
mSearchBar.addTextChangedListener(new TextWatcher() {
m_search.setOnFocusChangeListener((v, hasFocus) -> {
if (!hasFocus) {
m_search.clearFocus();
}else {
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).setFilter(m_search.getText().toString());
((historyAdapter) m_listview.getAdapter()).invokeFilter(true);
}
});
m_search.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2){
@ -113,34 +179,91 @@ public class historyController extends AppCompatActivity
@Override
public void afterTextChanged(Editable editable)
{
((historyAdapter) Objects.requireNonNull(mListView.getAdapter())).setFilter(mSearchBar.getText().toString());
((historyAdapter) mListView.getAdapter()).invokeFilter(true);
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).setFilter(m_search.getText().toString());
((historyAdapter) m_listview.getAdapter()).invokeFilter(true);
}
});
}
public void onBackPressed(View view){
@Override
public void onBackPressed() {
if(m_search.getVisibility() == View.VISIBLE){
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
}
else if(m_menu_button.getVisibility() == View.VISIBLE){
onClearMultipleSelection(null);
}
else {
this.finish();
}
public void onclearDataTrigger(View view){
pluginController.getInstance().MessageManagerHandler(this, Collections.singletonList(strings.EMPTY_STR),enums.etype.clear_history);
}
public void onBackPressed(View view){
if(m_search.getVisibility() == View.VISIBLE){
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
}
else if(m_menu_button.getVisibility() == View.VISIBLE){
onClearMultipleSelection(null);
}
else {
this.finish();
}
}
public void onclearDataTrigger(View view){
}
public void onclearData(){
mListModel.clearList();
((historyAdapter) Objects.requireNonNull(mListView.getAdapter())).invokeFilter(true );
mHistoryViewController.clearList();
databaseController.getInstance().execSQL("delete from history where 1",null);
m_list_model.clearList();
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).invokeFilter(true );
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_CLEAR_LIST, null);
databaseController.getInstance().execSQL(sql.H_CLEAR_DATA,null);
finish();
}
public void onLoadMoreHostory(View view)
{
dataController.getInstance().loadMoreHistory();
boolean isLoadingMore = false;
boolean is_page_loading = true;
private boolean loadMore() {
if(!isLoadingMore){
if(is_page_loading){
is_page_loading = false;
return false;
}
isLoadingMore = true;
new Thread(){
public void run(){
if(!m_is_recyclerview_loading){
int m_size = m_list_model.getList().size();
m_is_recyclerview_loading = true;
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).onLoading();
boolean m_history = (boolean)dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY ,null);
try {
sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
activityContextManager.getInstance().getHistoryController().runOnUiThread(() -> new Thread(){
public void run(){
((historyAdapter) Objects.requireNonNull(m_listview.getAdapter())).onLoadingClear();
isLoadingMore = false;
new Thread(){
public void run(){
try {
sleep(200);
m_is_recyclerview_loading = false;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}.start();
public void updateHistory(){
initializeList();
mHistoryViewController.updateList();
}
}.start());
}
}
}.start();
}
return true;
}
@Override
@ -148,7 +271,7 @@ public class historyController extends AppCompatActivity
{
if(status.sIsAppPaused && (level==80 || level==15))
{
dataController.getInstance().setBool(keys.LOW_MEMORY,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
finish();
}
}
@ -168,34 +291,75 @@ public class historyController extends AppCompatActivity
super.onPause();
}
public void onHideSearch(View view) {
((historyAdapter)m_listview.getAdapter()).onUpdateSearchStatus(m_history_view_controller.onHideSearch());
}
public void onLongPressMenu(View view) {
m_history_view_controller.onLongPressMenu(view);
}
public void onOpenMultipleTabs(View view) {
ArrayList<String> m_long_selected_urk = ((historyAdapter)m_listview.getAdapter()).getLongSelectedleURL();
for(int m_counter=0;m_counter<m_long_selected_urk.size();m_counter++){
m_home_controller.onOpenLinkNewTab(m_long_selected_urk.get(m_counter));
}
onBackPressed(null);
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
m_history_view_controller.onCloseMenu();
}
public void onShareSelectedURL(View view) {
String m_joined_url = ((historyAdapter)m_listview.getAdapter()).getSelectedURL();
helperMethod.shareURL(this, m_joined_url);
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
m_history_view_controller.onCloseMenu();
}
public void onClearMultipleSelection(View view) {
((historyAdapter)m_listview.getAdapter()).clearLongSelectedURL();
m_history_view_controller.onCloseMenu();
}
public void onDeleteSelected(View view) {
m_history_view_controller.onCloseMenu();
((historyAdapter)m_listview.getAdapter()).onDeleteSelected();
}
/*Event Observer*/
public class adapterCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.url_triggered)){
String url_temp = helperMethod.completeURL(data.get(0).toString());
pluginController.getInstance().logEvent(strings.HISTORY_TRIGGERED);
mHomeController.onLoadURL(url_temp);
m_home_controller.onLoadURL(url_temp);
finish();
}
else if(e_type.equals(enums.etype.url_triggered_new_tab)){
String url_temp = helperMethod.completeURL(data.get(0).toString());
pluginController.getInstance().logEvent(strings.HISTORY_TRIGGERED);
m_home_controller.onOpenLinkNewTab(url_temp);
finish();
}
else if(e_type.equals(enums.etype.url_clear)){
mListModel.onManualClear((int)data.get(0));
m_list_model.onManualClear((int)data.get(0));
}
else if(e_type.equals(enums.etype.url_clear_at)){
dataController.getInstance().removeHistory(data.toString());
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_REMOVE_HISTORY ,data);
}
else if(e_type.equals(enums.etype.is_empty)){
mHistoryViewController.removeFromList((int)data.get(0));
mHistoryViewController.updateIfListEmpty(mListModel.getList().size(),300);
m_history_view_controller.onTrigger(historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY, Arrays.asList(m_list_model.getList().size(),300));
}
else if(e_type.equals(enums.etype.remove_from_database)){
databaseController.getInstance().deleteFromList((int)data.get(0),"history");
databaseController.getInstance().deleteFromList((int)data.get(0),strings.H_HISTORY_TITLE);
}
else if(e_type.equals(enums.etype.on_verify_selected_url_menu)){
m_history_view_controller.onTrigger(M_VERTIFY_SELECTION_MENU, data);
}
return null;
}
}
}
}

View File

@ -0,0 +1,9 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
public class historyEnums
{
/*Settings Manager*/
public enum eHistoryViewCommands {
M_UPDATE_LIST_IF_EMPTY, M_UPDATE_LIST, M_REMOVE_FROM_LIST, M_CLEAR_LIST,M_VERTIFY_SELECTION_MENU
}
}

View File

@ -8,16 +8,13 @@ class historyModel
private ArrayList<historyRowModel> mModelList = new ArrayList<>();
/*Initializations*/
/*Helper Methods*/
void setList(ArrayList<historyRowModel> model)
{
mModelList = model;
}
ArrayList<historyRowModel> getList()
{
return mModelList;
}
private void removeFromMainList(int index)
{
mModelList.remove(index);
@ -31,6 +28,9 @@ class historyModel
mModelList.clear();
}
ArrayList<historyRowModel> getList()
{
return mModelList;
}
}

View File

@ -1,48 +1,58 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
import com.darkweb.genesissearchengine.constants.strings;
import android.widget.ImageView;
import java.util.Calendar;
import java.util.Date;
public class historyRowModel
{
/*Private Variables*/
private int mId;
private String mTitle;
private String mHeader;
private String mDescription;
private int m_id;
private String m_header;
private String m_description;
private Date m_date;
private ImageView m_logo;
/*Initializations*/
public historyRowModel(String mHeader, String mDescription,int mId) {
this.mId = mId;
this.mHeader = mHeader;
this.mDescription = mDescription;
this.mTitle = strings.EMPTY_STR;
public historyRowModel(String p_header, String p_description,int p_id) {
this.m_id = p_id;
this.m_header = p_header;
this.m_description = p_description;
m_date = Calendar.getInstance().getTime();
}
/*Variable Setters*/
public void setHeader(String p_header){
this.m_header = p_header;
}
public void setURL(String p_url){
this.m_description = p_url;
}
public void setLogo(ImageView p_logo){
this.m_logo = p_logo;
}
public void setDate(Date p_date) {
m_date = p_date;
}
/*Variable Getters*/
public void updateTitle(String mTitle){
this.mTitle = mTitle;
public String getHeader() {
return m_header;
}
public void updateHeader(String mHeader){
this.mHeader = mHeader;
public String getDescription() {
return m_description;
}
public void updateURL(String url){
this.mHeader = url;
public int getID() {
return m_id;
}
public String getTitle(){
return mTitle;
public ImageView getLogo() {
return m_logo;
}
public String getmHeader() {
return mHeader;
}
public String getmDescription() {
return mDescription;
}
public int getmId() {
return mId;
public Date getDate() {
return m_date;
}
}

View File

@ -1,93 +1,206 @@
package com.darkweb.genesissearchengine.appManager.historyManager;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.ActionMenuView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.PopupWindow;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.darkweb.genesissearchengine.constants.strings;
import com.example.myapplication.R;
import java.util.List;
import java.util.Objects;
import static android.content.Context.LAYOUT_INFLATER_SERVICE;
class historyViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private AppCompatActivity m_context;
private ImageView mEmptyListNotifier;
private EditText mSearchBar;
private RecyclerView mListView;
private Button mClearButton;
private ImageButton mMoreButton;
private ImageView m_empty_list;
private EditText m_search;
private RecyclerView m_listview;
private Button m_clearButton;
private ImageButton m_menu_button;
private ImageButton m_search_button;
/*Initializations*/
historyViewController(ImageView mEmptyListNotifier, EditText mSearchBar, RecyclerView mListView, Button mClearButton,ImageButton mMoreButton,AppCompatActivity mContext)
historyViewController(ImageView p_empty_list, EditText p_search, RecyclerView p_listview, Button p_clearButton,AppCompatActivity p_context,ImageButton p_menu_button,ImageButton p_search_button)
{
this.mContext = mContext;
this.mEmptyListNotifier = mEmptyListNotifier;
this.mSearchBar = mSearchBar;
this.mListView = mListView;
this.mClearButton = mClearButton;
this.mMoreButton = mMoreButton;
this.m_empty_list = p_empty_list;
this.m_search = p_search;
this.m_listview = p_listview;
this.m_clearButton = p_clearButton;
this.m_context = p_context;
this.m_menu_button = p_menu_button;
this.m_search_button = p_search_button;
initPostUI();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
Window window = m_context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
}
else {
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
}
}
}
void updateIfListEmpty(int size,int duration){
private void updateIfListEmpty(int size,int duration){
if(size>0){
mEmptyListNotifier.animate().setDuration(duration).alpha(0f);
mClearButton.animate().setDuration(duration).alpha(1f);
mMoreButton.animate().setDuration(duration).alpha(1f);
m_empty_list.animate().setDuration(duration).alpha(0f);
// m_clearButton.animate().setDuration(duration).alpha(1f);
m_clearButton.setText("CLEAR HISTORY");
m_clearButton.setClickable(true);
}
else {
mEmptyListNotifier.animate().setDuration(duration).alpha(1f);
mClearButton.animate().setDuration(duration).alpha(0f);
mMoreButton.animate().setDuration(duration).alpha(0f);
m_empty_list.animate().setDuration(duration).alpha(1f);
// m_clearButton.animate().setDuration(duration).alpha(0f);
m_clearButton.setText("NO HISTORY FOUND");
m_clearButton.setClickable(false);
}
}
void updateList(){
int index = Objects.requireNonNull(mListView.getAdapter()).getItemCount()-1;
mListView.getAdapter().notifyDataSetChanged();
mListView.scrollToPosition(index);
public void onCloseMenu(){
if(popupWindow!=null && popupWindow.isShowing()){
popupWindow.dismiss();
}
}
void removeFromList(int index)
private void onSelectionMenu(boolean p_status){
if(!p_status){
m_clearButton.setClickable(false);
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.float_white));
m_menu_button.setVisibility(View.VISIBLE);
m_search_button.setVisibility(View.GONE);
if (m_search.getVisibility() == View.VISIBLE){
m_search.animate().cancel();
m_search.animate().alpha(0).setDuration(150).withEndAction(() -> {
m_search.getText().clear();
m_search.setVisibility(View.GONE);
});
m_search.setClickable(false);
}
}else {
if (m_search.getVisibility() != View.VISIBLE) {
m_clearButton.setClickable(true);
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.blue));
}
m_menu_button.setVisibility(View.GONE);
m_search_button.setVisibility(View.VISIBLE);
}
}
private void updateList(){
int index = Objects.requireNonNull(m_listview.getAdapter()).getItemCount()-1;
m_listview.getAdapter().notifyDataSetChanged();
m_listview.scrollToPosition(index);
}
private void removeFromList(int index)
{
Objects.requireNonNull(mListView.getAdapter()).notifyItemRemoved(index);
mListView.getAdapter().notifyItemRangeChanged(index, mListView.getAdapter().getItemCount());
Objects.requireNonNull(m_listview.getAdapter()).notifyItemRemoved(index);
m_listview.getAdapter().notifyItemRangeChanged(index, m_listview.getAdapter().getItemCount());
}
void clearList(){
Objects.requireNonNull(mListView.getAdapter()).notifyDataSetChanged();
updateIfListEmpty(mListView.getAdapter().getItemCount(),300);
mSearchBar.clearFocus();
mSearchBar.setText(strings.EMPTY_STR);
private void clearList(){
Objects.requireNonNull(m_listview.getAdapter()).notifyDataSetChanged();
updateIfListEmpty(m_listview.getAdapter().getItemCount(),300);
m_search.clearFocus();
m_search.setText(strings.EMPTY_STR);
}
public void onTrigger(historyEnums.eHistoryViewCommands p_commands, List<Object> p_data){
if(p_commands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST_IF_EMPTY){
updateIfListEmpty((int)p_data.get(0), (int)p_data.get(1));
}
else if(p_commands == historyEnums.eHistoryViewCommands.M_UPDATE_LIST){
updateList();
}
else if(p_commands == historyEnums.eHistoryViewCommands.M_REMOVE_FROM_LIST){
removeFromList((int)p_data.get(0));
}
else if(p_commands == historyEnums.eHistoryViewCommands.M_CLEAR_LIST){
clearList();
}
else if(p_commands == historyEnums.eHistoryViewCommands.M_VERTIFY_SELECTION_MENU){
onSelectionMenu((boolean)p_data.get(0));
}
}
public boolean onHideSearch() {
if(m_search.getVisibility() == View.VISIBLE){
m_search.animate().cancel();
m_search.animate().alpha(0).setDuration(150).withEndAction(() -> {
m_search.setVisibility(View.GONE);
m_search.setText(strings.EMPTY_STR);
});
m_search.setText(strings.EMPTY_STR);
m_search.setClickable(false);
m_clearButton.setClickable(true);
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.blue));
return false;
}else {
m_search.animate().cancel();
m_search.setAlpha(0f);
m_search.animate().setDuration(150).alpha(1);
m_search.setVisibility(View.VISIBLE);
m_search.setClickable(true);
m_clearButton.setClickable(false);
m_clearButton.setTextColor(m_context.getApplication().getResources().getColor(R.color.float_white));
m_search.requestFocus();
InputMethodManager imm = (InputMethodManager) m_context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
return true;
}
}
private PopupWindow popupWindow = null;
public void onLongPressMenu(View view) {
if(popupWindow!=null){
popupWindow.dismiss();
}
LayoutInflater layoutInflater
= (LayoutInflater) view.getContext()
.getSystemService(LAYOUT_INFLATER_SERVICE);
final View popupView = layoutInflater.inflate(R.layout.history_choose_popup_menu, null);
popupWindow = new PopupWindow(
popupView,
ActionMenuView.LayoutParams.WRAP_CONTENT,
ActionMenuView.LayoutParams.WRAP_CONTENT, true);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true);
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
popupWindow.setAnimationStyle(R.style.popup_window_animation);
popupWindow.showAtLocation(view, Gravity.TOP|Gravity.END,0,0);
popupWindow.setElevation(7);
}
}

View File

@ -1,10 +1,8 @@
package com.darkweb.genesissearchengine.appManager.homeManager;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.util.Log;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.*;
@ -13,16 +11,17 @@ import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.io.File;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.enums.etype.on_handle_external_intent;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_DESKTOP;
import static org.mozilla.geckoview.GeckoSessionSettings.USER_AGENT_MODE_MOBILE;
import static org.mozilla.geckoview.StorageController.ClearFlags.ALL;
import org.mozilla.geckoview.ContentBlocking;
import org.mozilla.geckoview.GeckoRuntime;
import org.mozilla.geckoview.GeckoSession;
import org.mozilla.geckoview.GeckoSessionSettings;
import org.mozilla.geckoview.GeckoView;
import mozilla.components.browser.engine.gecko.GeckoEngine;
import mozilla.components.browser.icons.*;
class geckoClients
{
@ -42,7 +41,6 @@ class geckoClients
this.event = event;
mGlobalSessionCounter+=1;
mSessionID = mGlobalSessionCounter;
runtimeSettings(context);
if(!isForced && geckoView.getSession()!=null && geckoView.getSession().isOpen()){
@ -210,9 +208,9 @@ class geckoClients
public class geckoViewClientCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if (mSessionID == (int)data.get(1) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url))
if (mSessionID == (int)data.get(1) || e_type.equals(enums.etype.on_update_favicon) ||e_type.equals(enums.etype.on_update_history) || e_type.equals(enums.etype.on_request_completed) || e_type.equals(enums.etype.on_update_suggestion) || e_type.equals(enums.etype.on_update_suggestion_url))
{
if (e_type.equals(on_handle_external_intent))
{
@ -222,9 +220,10 @@ class geckoClients
context.startActivity(intent);
} else
{
event.invokeObserver(data, e_type);
return event.invokeObserver(data, e_type);
}
}
return null;
}
}
}

View File

@ -25,14 +25,11 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.helperManager.AdBlocker;
import com.darkweb.genesissearchengine.helperManager.JavaScriptInterface;
import com.darkweb.genesissearchengine.helperManager.downloadFileService;
import com.darkweb.genesissearchengine.helperManager.errorHandler;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.example.myapplication.R;
import org.mozilla.gecko.GeckoSystemStateListener;
import org.mozilla.gecko.GeckoThread;
@ -69,6 +66,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
/*Temp Variables*/
private GeckoSession.HistoryDelegate.HistoryList mHistoryList = null;
private int rateCount=0;
private int m_current_url_id = -1;
geckoSession(eventObserver.eventListener event,int mSessionID,AppCompatActivity mContext){
@ -80,7 +78,6 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
setContentDelegate(this);
mDownloadManager = new geckoDownloadManager();
setPromptDelegate(new geckoPromptView(mContext));
this.event = event;
}
@ -101,6 +98,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
mProgress = 5;
event.invokeObserver(Arrays.asList(5, mSessionID), enums.etype.progress_update);
}
m_current_url_id = -1;
}
/*Progress Delegate*/
@ -109,6 +107,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
public void onPageStart(@NonNull GeckoSession var1, @NonNull String var2) {
if(!isPageLoading){
mCurrentTitle = "loading";
m_current_url_id = -1;
}
isPageLoading = true;
if(!var2.equals("about:blank") && !mCurrentTitle.equals("loading")){
@ -125,6 +124,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
@UiThread
public void onPageStop(@NonNull GeckoSession var1, boolean var2) {
}
@Override
@ -145,7 +145,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
public GeckoResult<Boolean> onVisited(@NonNull GeckoSession var1, @NonNull String var2, @Nullable String var3, int var4) {
if(var4==3 || var4==5 || var4==1){
event.invokeObserver(Arrays.asList(var2,mSessionID), enums.etype.on_url_load);
event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle), enums.etype.on_request_completed);
m_current_url_id = (int)event.invokeObserver(Arrays.asList(var2,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
isPageLoading = false;
}
return null;
@ -161,7 +161,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
String newUrl = var2.split("#")[0];
if(!mCurrentTitle.equals("loading")){
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion_url);
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
}
mCurrentURL = newUrl;
@ -231,7 +231,7 @@ public class geckoSession extends GeckoSession implements GeckoSession.Permissio
public void onTitleChange(@NonNull GeckoSession var1, @Nullable String var2) {
if(var2!=null && !var2.equals(strings.EMPTY_STR) && var2.length()>2 && !var2.equals("about:blank")){
mCurrentTitle = var2;
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle), enums.etype.on_update_suggestion);
m_current_url_id = (int)event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, m_current_url_id), enums.etype.on_update_history);
}
}

View File

@ -16,7 +16,6 @@ import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@ -25,7 +24,6 @@ import android.widget.*;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkController;
@ -43,8 +41,8 @@ import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.appManager.orbotManager.orbotController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.KeyboardUtils;
import com.darkweb.genesissearchengine.helperManager.LocaleUtils;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
@ -157,7 +155,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(status.sFirstStart){
helperMethod.openActivity(landingController.class, constants.LIST_HISTORY, homeController.this,false);
status.sFirstStart = false;
dataController.getInstance().setBool(keys.FIRST_INSTALLED,false);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.FIRST_INSTALLED,false));
}
}
@ -173,12 +171,11 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mProgressBar = findViewById(R.id.progressBar);
mSplashScreen = findViewById(R.id.splashScreen);
mSearchbar = findViewById(R.id.search);
mSearchbar = findViewById(R.id.p_search);
mLoadingIcon = findViewById(R.id.imageView_loading_back);
mLoadingText = findViewById(R.id.loadingText);
mWebViewContainer = findViewById(R.id.webviewContainer);
mBannerAds = findViewById(R.id.adView);
mEngineLogo = findViewById(R.id.switchEngine);
mGatewaySplash = findViewById(R.id.gateway_splash);
mTopBar = findViewById(R.id.topbar);
mBackSplash = findViewById(R.id.backsplash);
@ -189,9 +186,9 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mGeckoView.setSaveFromParentEnabled(false);
mGeckoClient = new geckoClients();
boolean is_engine_switched = dataController.getInstance().getBool(keys.ENGINE_SWITCHED,false);
boolean is_engine_switched = (boolean) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.ENGINE_SWITCHED,false));
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mEngineLogo, mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack);
mHomeViewController.initialization(new homeViewCallback(),this,mNewTab, mWebViewContainer, mLoadingText, mProgressBar, mSearchbar, mSplashScreen, mLoadingIcon, mBannerAds,dataController.getInstance().getSuggestions(), mGatewaySplash, mTopBar, mGeckoView, mBackSplash,is_engine_switched, mConnectButton, mSwitchEngineBack);
}
public void initPreFixes() {
@ -410,7 +407,8 @@ public class homeController extends AppCompatActivity implements ComponentCallba
mHomeViewController.onSessionChanged();
}
public void onOpenTabView(View view){
public void onOpenTabViewBoundary(View view){
mNewTab.setPressed(true);
helperMethod.openActivity(tabController.class, constants.LIST_HISTORY, homeController.this,true);
}
@ -444,14 +442,14 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
public void onSwitchSearch(View view){
dataController.getInstance().setBool(keys.ENGINE_SWITCHED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.ENGINE_SWITCHED,true));
pluginController.getInstance().logEvent(strings.SEARCH_SWITCH);
if(status.sSearchStatus.equals(constants.BACKEND_GOOGLE_URL))
{
status.sSearchStatus = constants.BACKEND_GENESIS_URL;
mHomeViewController.onUpdateLogo();
dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL));
onHomeButton(null);
}
else if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL))
@ -460,7 +458,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(pluginController.getInstance().isOrbotRunning())
{
mHomeViewController.onUpdateLogo();
dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_DUCK_DUCK_GO_URL);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_DUCK_DUCK_GO_URL));
onHomeButton(null);
}
else {
@ -473,7 +471,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
if(pluginController.getInstance().isOrbotRunning())
{
mHomeViewController.onUpdateLogo();
dataController.getInstance().setString(keys.SEARCH_ENGINE,constants.BACKEND_GOOGLE_URL);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GOOGLE_URL));
onHomeButton(null);
}
else {
@ -684,7 +682,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
else if (menuId == R.id.menu2)
{
dataController.getInstance().setBool(keys.IS_APP_RATED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
status.sIsAppRated = true;
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app);
}
@ -721,7 +719,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public class homeViewCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.download_folder))
{
@ -738,7 +736,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.recheck_orbot)){
pluginController.getInstance().isOrbotRunning();
}
return null;
}
}
@ -764,7 +762,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
public class geckoViewCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.progress_update)){
mHomeViewController.onProgressBarUpdate((int)data.get(0));
@ -784,16 +782,15 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.start_proxy)){
pluginController.getInstance().setProxy(dataToStr(data.get(0)));
}
else if(e_type.equals(enums.etype.on_request_completed)){
Log.i("RUQUEST_SEND","REQUREST_SEND"+data.get(0));
dataController.getInstance().addHistory(data.get(0).toString(),data.get(2).toString());
else if(e_type.equals(enums.etype.on_update_history)){
return dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_ADD_HISTORY ,data);
}
else if(e_type.equals(enums.etype.on_update_suggestion)){
dataController.getInstance().addSuggesion(data.get(0).toString(),data.get(2).toString());
}
else if(e_type.equals(enums.etype.on_page_loaded)){
pluginController.getInstance().logEvent(strings.PAGE_OPENED_SUCCESS);
dataController.getInstance().setBool(keys.IS_BOOTSTRAPPED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_BOOTSTRAPPED,true));
mHomeViewController.onPageFinished();
if(status.sIsWelcomeEnabled && !status.sIsAppStarted){
final Handler handler = new Handler();
@ -816,7 +813,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
}
else if(e_type.equals(enums.etype.rate_application)){
if(!status.sIsAppRated){
dataController.getInstance().setBool(keys.IS_APP_RATED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
status.sIsAppRated = true;
pluginController.getInstance().MessageManagerHandler(activityContextManager.getInstance().getHomeController(), Collections.singletonList(strings.EMPTY_STR), enums.etype.rate_app);
}
@ -837,6 +834,10 @@ public class homeController extends AppCompatActivity implements ComponentCallba
boolean status = (Boolean)data.get(0);
mHomeViewController.onFullScreenUpdate(status);
}
else if(e_type.equals(enums.etype.on_update_favicon)){
boolean status = (Boolean)data.get(0);
dataController.getInstance().invokeImageCache(dataEnums.eImageCacheCommands.M_SET_IMAGE ,data);
}
else if(e_type.equals(enums.etype.on_long_press_with_link)){
pluginController.getInstance().MessageManagerHandler(homeController.this, Arrays.asList(dataToStr(data.get(0)),dataToStr(data.get(2)),dataToStr(data.get(3))),enums.etype.on_long_press_with_link);
}
@ -860,6 +861,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
else if(e_type.equals(enums.etype.on_update_suggestion_url)){
dataController.getInstance().updateSuggestionURL(dataToStr(data.get(0)),dataToStr(data.get(2)));
}
return null;
}
}
}

View File

@ -72,7 +72,6 @@ class homeViewController
private TextView mLoadingText;
private AdView mBannerAds = null;
private Handler mUpdateUIHandler = null;
private ImageView mEngineLogo;
private ImageButton mSwitchEngineBack;
private ImageButton mGatewaySplash;
private LinearLayout mTopBar;
@ -88,7 +87,7 @@ class homeViewController
private boolean isLandscape = false;
private boolean disableSplash = false;
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, com.darkweb.genesissearchengine.widget.AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList<historyRowModel> suggestions, ImageView engineLogo, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, boolean is_triggered, Button connect_button, ImageButton switch_engine_back){
void initialization(eventObserver.eventListener event, AppCompatActivity context, Button mNewTab, FrameLayout webviewContainer, TextView loadingText, com.darkweb.genesissearchengine.widget.AnimatedProgressBar progressBar, AutoCompleteTextView searchbar, ConstraintLayout splashScreen, ImageView loading, AdView banner_ads, ArrayList<historyRowModel> suggestions, ImageButton gateway_splash, LinearLayout top_bar, GeckoView gecko_view, ImageView backsplash, boolean is_triggered, Button connect_button, ImageButton switch_engine_back){
this.mContext = context;
this.mProgressBar = progressBar;
this.mSearchbar = searchbar;
@ -98,7 +97,6 @@ class homeViewController
this.mWebviewContainer = webviewContainer;
this.mBannerAds = banner_ads;
this.mEvent = event;
this.mEngineLogo = engineLogo;
this.mGatewaySplash = gateway_splash;
this.mTopBar = top_bar;
this.mGeckoView = gecko_view;
@ -116,18 +114,6 @@ class homeViewController
}
private void initSearchImage(){
if(status.sSearchStatus.equals(constants.BACKEND_GENESIS_URL))
{
mEngineLogo.setImageResource(R.drawable.duck_logo);
}
else if(status.sSearchStatus.equals(constants.BACKEND_DUCK_DUCK_GO_URL))
{
mEngineLogo.setImageResource(R.drawable.google_logo);
}
else
{
mEngineLogo.setImageResource(R.drawable.genesis_logo);
}
}
void initTab(int count){
@ -588,12 +574,26 @@ class homeViewController
}
}
private void disableEnableControls(boolean enable, ViewGroup vg){
vg.setEnabled(enable); // the point that I was missing
for (int i = 0; i < vg.getChildCount(); i++){
View child = vg.getChildAt(i);
child.setEnabled(enable);
child.setClickable(enable);
if (child instanceof ViewGroup){
disableEnableControls(enable, (ViewGroup)child);
}
}
}
private int defaultFlag = 0;
void onFullScreenUpdate(boolean status){
int value = !status ? 1 : 0;
mTopBar.setClickable(!status);
disableEnableControls(!status, mTopBar);
mTopBar.setAlpha(value);
mBannerAds.setVisibility(View.GONE);
if(status){
mWebviewContainer.setPadding(0,0,0,0);
@ -647,15 +647,6 @@ class homeViewController
switch (status.sSearchStatus)
{
case constants.BACKEND_GOOGLE_URL:
mEngineLogo.setImageResource(R.drawable.genesis_logo);
break;
case constants.BACKEND_GENESIS_URL:
mEngineLogo.setImageResource(R.drawable.duck_logo);
break;
case constants.BACKEND_DUCK_DUCK_GO_URL:
mEngineLogo.setImageResource(R.drawable.google_logo);
break;
}
}

View File

@ -47,7 +47,7 @@ public class landingController extends AppIntro {
// OPTIONAL METHODS
// Override bar/separator color.
setBarColor(getResources().getColor(R.color.landing_ease_blue));
setSeparatorColor(getResources().getColor(R.color.panel_background_main));
setSeparatorColor(getResources().getColor(R.color.white));
// Hide Skip/Done button.
showSkipButton(false);

View File

@ -8,10 +8,12 @@ import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@ -46,15 +48,16 @@ public class languageController extends AppCompatActivity {
public class languageViewCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public void changeLanguage(Locale language){
status.sLanguage = language.getLanguage();
dataController.getInstance().setString(keys.LANGUAGE,language.getLanguage());
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.LANGUAGE,language.getLanguage()));
pluginController.getInstance().setLanguage(this);
}

View File

@ -1,29 +1,34 @@
package com.darkweb.genesissearchengine.appManager.orbotManager;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Switch;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bridgeManager.bridgeController;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.Arrays;
import java.util.Collections;
public class orbotController extends AppCompatActivity {
private Switch mBridgeSwitch;
private orbotViewController mOrbotViewController;
/* PRIVATE VARIABLES */
private SwitchMaterial m_bridge_switch;
private SwitchMaterial m_vpn_switch;
private orbotViewController m_orbot_view_controller;
private LinearLayout m_customizable_bridge_menu;
/* INITIALIZATIONS */
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -32,14 +37,44 @@ public class orbotController extends AppCompatActivity {
setContentView(R.layout.orbot_settings_view);
viewsInitializations();
listenersInitializations();
}
public void viewsInitializations() {
m_bridge_switch = findViewById(R.id.p_bridge_switch);
m_vpn_switch = findViewById(R.id.p_vpn_switch);
m_customizable_bridge_menu = findViewById(R.id.p_customizable_bridge_menu);
m_orbot_view_controller = new orbotViewController(m_bridge_switch,m_vpn_switch, this, m_customizable_bridge_menu);
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_UI, Arrays.asList(status.sVPNStatus,status.sBridgeStatus));
}
// status.sGatewayAuto || status.sGatewayManual
/* LISTENERS */
public void onBridgeSwitch(View view){
status.sBridgeStatus = !m_bridge_switch.isChecked();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.S_BRIDGE_ENABLES,status.sBridgeStatus));
pluginController.getInstance().updateBridges(status.sBridgeStatus);
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS, Collections.singletonList(status.sBridgeStatus));
}
public void openBridgeSettings(View view){
helperMethod.openActivity(bridgeController.class, constants.LIST_HISTORY, orbotController.this, true);
}
public void onVPNSwitch(View view){
status.sVPNStatus = !m_vpn_switch.isChecked();
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.S_VPN_ENABLED,status.sVPNStatus));
m_orbot_view_controller.updateVPN(status.sVPNStatus);
pluginController.getInstance().updateVPN(status.sVPNStatus);
}
/* LOCAL OVERRIDES */
@Override
public void onResume()
{
activityContextManager.getInstance().setCurrentActivity(this);
mOrbotViewController.initViews();
m_orbot_view_controller.onTrigger(orbotEnums.eOrbotViewCommands.M_INIT_POST_UI,null);
super.onResume();
}
@ -57,27 +92,4 @@ public class orbotController extends AppCompatActivity {
public void onClose(View view){
finish();
}
public void viewsInitializations() {
mBridgeSwitch = findViewById(R.id.bridgeSwitch);
mOrbotViewController = new orbotViewController(mBridgeSwitch,this);
}
public void listenersInitializations() {
mBridgeSwitch.setOnClickListener(view ->
{
Switch switch_view = (Switch)view;
switch_view.setChecked(!switch_view.isChecked());
helperMethod.openActivity(bridgeController.class, constants.LIST_HISTORY, orbotController.this,true);
});
}
public void onClearCache(View view){
helperMethod.clearAppData(this);
((Switch)view).setChecked(false);
}
}

View File

@ -0,0 +1,9 @@
package com.darkweb.genesissearchengine.appManager.orbotManager;
public class orbotEnums
{
/*Settings Manager*/
public enum eOrbotViewCommands {
M_UPDATE_BRIDGE_SETTINGS_VIEWS, M_INIT_POST_UI, M_INIT_UI
}
}

View File

@ -4,51 +4,93 @@ import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.status;
import com.example.myapplication.R;
import com.google.android.material.switchmaterial.SwitchMaterial;
import java.util.List;
class orbotViewController
{
/*Private Variables*/
private AppCompatActivity mContext;
private Switch mBridgeSwitch;
private AppCompatActivity m_context;
private SwitchMaterial m_bridge_switch;
private SwitchMaterial m_vpn_switch;
private LinearLayout m_customizable_bridge_menu;
/*Initializations*/
orbotViewController(Switch mBridgeSwitch, AppCompatActivity mContext)
orbotViewController(SwitchMaterial p_bridge_switch, SwitchMaterial p_vpn_switch, AppCompatActivity p_context, LinearLayout p_customizable_bridge_menu)
{
this.mContext = mContext;
this.mBridgeSwitch = mBridgeSwitch;
this.m_context = p_context;
this.m_bridge_switch = p_bridge_switch;
this.m_customizable_bridge_menu = p_customizable_bridge_menu;
this.m_vpn_switch = p_vpn_switch;
initPostUI();
initViews();
}
private void initPostUI(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = mContext.getWindow();
Window window = m_context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
window.setStatusBarColor(mContext.getResources().getColor(R.color.blue_dark));
window.setStatusBarColor(m_context.getResources().getColor(R.color.blue_dark));
}
else {
mContext.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
mContext.getWindow().setStatusBarColor(ContextCompat.getColor(mContext, R.color.white));
m_context.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);// set status text dark
m_context.getWindow().setStatusBarColor(ContextCompat.getColor(m_context, R.color.white));
}
}
}
public void initViews(){
mBridgeSwitch.setChecked(status.sGatewayAuto || status.sGatewayManual);
private void bridgeSettingsStatus(boolean p_status){
updateBridgeViews(p_status, true);
}
public void updateVPN(boolean p_status){
m_vpn_switch.setChecked(p_status);
}
public void updateBridgeViews(boolean p_status,boolean p_is_invoked){
m_bridge_switch.setChecked(p_status);
if(p_status){
m_customizable_bridge_menu.setClickable(true);
m_customizable_bridge_menu.setAlpha(0);
m_customizable_bridge_menu.setVisibility(View.VISIBLE);
if(p_is_invoked){
m_customizable_bridge_menu.animate().alpha(1);
}else {
m_customizable_bridge_menu.setAlpha(1);
}
}else {
m_customizable_bridge_menu.setClickable(false);
if(p_is_invoked){
m_customizable_bridge_menu.animate().alpha(0).withEndAction(() -> m_customizable_bridge_menu.setVisibility(View.GONE));
}else {
m_customizable_bridge_menu.setAlpha(0);
m_customizable_bridge_menu.setVisibility(View.GONE);
}
}
}
private void initViews(boolean p_vpn_status, boolean p_gateway_status){
updateBridgeViews(p_gateway_status, false);
updateVPN(p_vpn_status);
}
public void onTrigger(orbotEnums.eOrbotViewCommands p_commands, List<Object> p_data){
if(p_commands == orbotEnums.eOrbotViewCommands.M_UPDATE_BRIDGE_SETTINGS_VIEWS){
bridgeSettingsStatus((boolean) p_data.get(0));
}
else if(p_commands == orbotEnums.eOrbotViewCommands.M_INIT_POST_UI){
initPostUI();
}
else if(p_commands == orbotEnums.eOrbotViewCommands.M_INIT_UI){
initViews((boolean)p_data.get(0),(boolean) p_data.get(1));
}
}
}

View File

@ -15,9 +15,12 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.util.Arrays;
import java.util.List;
import static com.darkweb.genesissearchengine.constants.status.sCookieStatus;
import static com.darkweb.genesissearchengine.constants.status.sHistoryStatus;
@ -103,7 +106,7 @@ public class settingController extends AppCompatActivity
{
if(status.sIsAppPaused && (level==80 || level==15))
{
dataController.getInstance().setBool(keys.LOW_MEMORY,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
finish();
}
}
@ -202,34 +205,34 @@ public class settingController extends AppCompatActivity
public class settingViewCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
return null;
}
}
public class settingModelCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type == enums.etype.update_searcn){
status.sSearchStatus = (String)data.get(0);
mHomeController.onHomeButton(null);
dataController.getInstance().setString(keys.SEARCH_ENGINE, mSettingModel.getSearchStatus());
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_STRING, Arrays.asList(keys.SEARCH_ENGINE, mSettingModel.getSearchStatus()));
}
else if(e_type == enums.etype.update_javascript){
status.sJavaStatus = (boolean)data.get(0);
mHomeController.onUpdateJavascript();
dataController.getInstance().setBool(keys.JAVA_SCRIPT, status.sJavaStatus);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.JAVA_SCRIPT, status.sJavaStatus));
}
else if(e_type == enums.etype.update_history){
sHistoryStatus = (boolean)data.get(0);
dataController.getInstance().setBool(keys.HISTORY_CLEAR, sHistoryStatus);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.HISTORY_CLEAR, sHistoryStatus));
}
else if(e_type == enums.etype.update_notification){
pluginController.getInstance().setNotificationStatus((int)data.get(0));
dataController.getInstance().setInt(keys.NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus());
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.NOTIFICATION_STATUS, pluginController.getInstance().getNotificationStatus()));
int notificationStatus = pluginController.getInstance().getNotificationStatus();
if(notificationStatus==0){
@ -246,13 +249,15 @@ public class settingController extends AppCompatActivity
}
else if(e_type == enums.etype.update_cookies){
sCookieStatus = (int)data.get(0);
dataController.getInstance().setInt(keys.COOKIE_ADJUSTABLE, sCookieStatus);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE, sCookieStatus));
mHomeController.onUpdateCookies();
pluginController.getInstance().updateCookiesStatus();
}
else if(e_type == enums.etype.close_view){
finish();
}
return null;
}
}

View File

@ -5,7 +5,10 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import java.util.Arrays;
import java.util.Collections;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
@ -102,8 +105,8 @@ class settingModel
}
if(status.sFontAdjustable != mFontAdjustable)
{
dataController.getInstance().setBool(keys.FONT_ADJUSTABLE, mFontAdjustable);
dataController.getInstance().setInt(keys.FONT_SIZE,100);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.COOKIE_ADJUSTABLE,mFontAdjustable));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.FONT_SIZE,100));
status.sFontAdjustable = mFontAdjustable;
status.sFontSize = 100;
@ -117,8 +120,8 @@ class settingModel
mFontSize = 1;
}
dataController.getInstance().setInt(keys.FONT_SIZE,(int) mFontSize);
dataController.getInstance().setBool(keys.FONT_ADJUSTABLE,false);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.FONT_SIZE,mFontSize));
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.FONT_ADJUSTABLE,false));
status.sFontSize = mFontSize;
status.sFontAdjustable = false;
@ -129,7 +132,7 @@ class settingModel
if(status.sCookieStatus != mCookieStatus)
{
status.sCookieStatus = mCookieStatus;
dataController.getInstance().setInt(keys.COOKIE_ADJUSTABLE,status.sCookieStatus);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE,status.sCookieStatus));
mEvent.invokeObserver(Collections.singletonList(mCookieStatus), enums.etype.update_cookies);
}
mEvent.invokeObserver(Collections.singletonList(mHistoryStatus), enums.etype.close_view);

View File

@ -120,9 +120,9 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
void bindListView(tabRowModel model) {
heaaderText = itemView.findViewById(R.id.mHeader);
descriptionText = itemView.findViewById(R.id.mDescription);
itemContainer = itemView.findViewById(R.id.item_container);
heaaderText = itemView.findViewById(R.id.p_header);
descriptionText = itemView.findViewById(R.id.p_description);
itemContainer = itemView.findViewById(R.id.p_item_container);
if(model.getSession().getTitle().equals("") || model.getSession().getTitle().equals("loading")){
heaaderText.setText(helperMethod.getDomainName(model.getSession().getCurrentURL()));
@ -138,8 +138,8 @@ public class tabAdapter extends RecyclerView.Adapter<tabAdapter.listViewHolder>
}
descriptionText.setText(url);
messageButton = itemView.findViewById(R.id.message_button);
empty_message = itemView.findViewById(R.id.empty_list);
// messageButton = itemView.findViewById(R.id.message_button);
empty_message = itemView.findViewById(R.id.p_empty_list);
data_model = model;
}
}

View File

@ -1,7 +1,6 @@
package com.darkweb.genesissearchengine.appManager.tabManager;
import android.os.Bundle;
import android.os.Handler;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
@ -19,13 +18,13 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.example.myapplication.R;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -67,10 +66,10 @@ public class tabController extends AppCompatActivity
pluginController.getInstance().logEvent(strings.TAB_OPENED);
}
public void initializeViews(){
mEmptyListNotifier = findViewById(R.id.empty_list);
mSearchBar = findViewById(R.id.search);
mListView = findViewById(R.id.listview);
mClearButton = findViewById(R.id.clearButton);
mEmptyListNotifier = findViewById(R.id.p_empty_list);
mSearchBar = findViewById(R.id.p_search);
mListView = findViewById(R.id.p_listview);
mClearButton = findViewById(R.id.p_clearButton);
mtabViewController = new tabViewController(mEmptyListNotifier, mListView, mClearButton,this);
mClearButton.setText(R.string.tab_view_clear_tab);
}
@ -145,7 +144,7 @@ public class tabController extends AppCompatActivity
{
if(status.sIsAppPaused && (level==80 || level==15))
{
dataController.getInstance().setBool(keys.LOW_MEMORY,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.LOW_MEMORY,true));
finish();
}
}
@ -181,7 +180,7 @@ public class tabController extends AppCompatActivity
public class adapterCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype e_type)
public Object invokeObserver(List<Object> data, enums.etype e_type)
{
if(e_type.equals(enums.etype.clear_recycler)){
mListView.getRecycledViewPool().clear();
@ -209,6 +208,7 @@ public class tabController extends AppCompatActivity
}
mHomeController.initTabCount();
}
return null;
}
}

View File

@ -40,7 +40,7 @@ public class constants
public static final int MAX_LIST_DATA_SIZE =5000;
public static final int MAX_LIST_SIZE =5000;
public static final int START_LIST_SIZE =100;
public static final int FETCHABLE_LIST_SIZE =100;
public static final String DATABASE_NAME ="genesis_dbase";
/*ADMOB CONSTANTS*/

View File

@ -4,12 +4,12 @@ public class enums
{
/*Settings Manager*/
public enum etype{
HiddenWeb, DuckDuckGo,Google,
HiddenWeb, DuckDuckGo,Google, on_update_favicon,
hidden_onion, hidden_onion_start,hidden_base,
onion, base,
onion, base,on_verify_selected_url_menu,
welcome,abi_error,rate_success,reported_success,bookmark, clear_tab,clear_history,clear_bookmark,report_url,rate_app,version_warning,start_orbot,download_file,download_file_long_press,tor_banned,on_long_press_url,
cancel_welcome,ignore_abi,reload,connect_vpn,start_home,disable_splash,app_rated,download_file_manual,download_folder, update_searcn, update_javascript,update_notification, update_history,update_cookies, update_font_size,update_font_adjustable,close_view,open_link_new_tab,open_link_current_tab,copy_link,
url_triggered,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,load_more,
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab
url_triggered, url_triggered_new_tab,url_clear,clear_recycler,url_clear_at,remove_from_database,is_empty,load_more,
on_close_sesson,on_long_press,on_long_press_with_link,on_reset_app,on_bridge_mail,on_not_support,on_full_screen,on_error_cert,on_handle_external_intent,on_update_suggestion_url,progress_update,recheck_orbot,on_url_load,on_playstore_load,back_list_empty,redraw,start_proxy,start_proxy_back,start_proxy_forward,onMenuSelected,on_request_completed, on_update_history,on_update_suggestion,on_page_loaded,on_load_error,update_tab_title,download_file_popup,proxy_error,on_init_ads,rate_application,search_update, open_new_tab
}
}

View File

@ -43,5 +43,7 @@ public class keys
/*Bridge Settings*/
public static final String CUSTOM_BRIDGE_1 = "CLEAR_PREFS";
public static final String S_BRIDGE_ENABLES = "S_BRIDGE_ENABLES";
public static final String S_VPN_ENABLED = "S_VPN_ENABLED";
}

View File

@ -0,0 +1,10 @@
package com.darkweb.genesissearchengine.constants;
public class sql
{
/*HISTORY*/
public static final String H_CLEAR_DATA = "delete from history where 1";
}

View File

@ -1,6 +1,10 @@
package com.darkweb.genesissearchengine.constants;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import java.util.Arrays;
import static org.mozilla.geckoview.ContentBlocking.CookieBehavior.ACCEPT_FIRST_PARTY;
public class status
@ -31,24 +35,30 @@ public class status
public static boolean sGatewayAuto = false;
public static boolean sGatewayManual = false;
public static String sCustomBridge = strings.CUSTOM_BRIDGE;
public static boolean sVPNStatus = false;
public static boolean sBridgeStatus = false;
public static String sCustomBridge = strings.CUSTOM_BRIDGE_OBFS4;
public static void initStatus()
{
status.sJavaStatus = dataController.getInstance().getBool(keys.JAVA_SCRIPT,true);
status.sHistoryStatus = dataController.getInstance().getBool(keys.HISTORY_CLEAR,true);
status.sSearchStatus = dataController.getInstance().getString(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL);
status.sGatewayAuto = dataController.getInstance().getBool(keys.GATEWAY_AUTO,false);
status.sGatewayManual = dataController.getInstance().getBool(keys.GATEWAY_MANUAL,false);
status.sIsWelcomeEnabled = dataController.getInstance().getBool(keys.IS_WELCOME_ENABLED,true);
status.sIsAppRated = dataController.getInstance().getBool(keys.IS_APP_RATED,false);
status.sFontSize = dataController.getInstance().getFloat(keys.FONT_SIZE,100);
status.sFontAdjustable = dataController.getInstance().getBool(keys.FONT_ADJUSTABLE,true);
status.sCookieStatus = dataController.getInstance().getInt(keys.COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY);
status.sCustomBridge = dataController.getInstance().getString(keys.CUSTOM_BRIDGE_1,strings.CUSTOM_BRIDGE);
status.sFirstStart = dataController.getInstance().getBool(keys.FIRST_INSTALLED,true);
status.sLanguage = dataController.getInstance().getString(keys.LANGUAGE,strings.DEFAULT_LANGUAGE);
status.sJavaStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.JAVA_SCRIPT,true));
status.sHistoryStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.HISTORY_CLEAR,true));
status.sGatewayAuto = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.GATEWAY_AUTO,true));
status.sGatewayManual = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.GATEWAY_MANUAL,false));
status.sIsWelcomeEnabled = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.IS_WELCOME_ENABLED,true));
status.sIsAppRated = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.IS_APP_RATED,false));
status.sVPNStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.S_VPN_ENABLED,false));
status.sBridgeStatus = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.S_BRIDGE_ENABLES,true));
status.sFontAdjustable = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.FONT_ADJUSTABLE,true));
status.sFirstStart = (boolean)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_BOOL, Arrays.asList(keys.FIRST_INSTALLED,true));
status.sCookieStatus = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.COOKIE_ADJUSTABLE,ACCEPT_FIRST_PARTY));
status.sFontSize = (int)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_FLOAT, Arrays.asList(keys.FONT_SIZE,100));
status.sLanguage = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.LANGUAGE,strings.DEFAULT_LANGUAGE));
status.sSearchStatus = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.SEARCH_ENGINE,constants.BACKEND_GENESIS_URL));
status.sCustomBridge = (String)dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_STRING, Arrays.asList(keys.CUSTOM_BRIDGE_1,strings.CUSTOM_BRIDGE_OBFS4));
}
}

View File

@ -93,13 +93,19 @@ public class strings
public static final String BANNED_TITLE = "Is Tor Bannned In Your Country?";
public static final String BANNED_DESC = "Enable free GATEWAY to tunnel through banned configuration | Use it only if tor is banned in your country";
/*History Manager*/
public static final String H_HISTORY_TITLE = "history";
/*Tab Manager*/
public static final String CLEAR_TABS = "CLEAR TABS";
/*Bridge Manager*/
public static final String CUSTOM_BRIDGE = "obfs4";
public static final String CUSTOM_BRIDGE_OBFS4 = "obfs4";
public static final String CUSTOM_BRIDGE_MEEK = "meek";
public static final String CUSTOM_BRIDGE_CUSTOM = "custom";
/*Text Manager*/

View File

@ -1,27 +1,28 @@
package com.darkweb.genesissearchengine.dataManager;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class dataController
{
/*Private Variables*/
private dataModel mPreferencesModel;
private historyController mHistoryController;
private dataModel m_data_model;
private preferenceDataModel m_preference_model;
private historyDataModel m_history_model;
private imageCacheModel m_image_cache_model;
/*Private Declarations*/
@ -34,16 +35,17 @@ public class dataController
/*Initializations*/
public void initialize(AppCompatActivity app_context){
mPreferencesModel = new dataModel(app_context);
mPreferencesModel.initializeBookmarks();
mPreferencesModel.setMaxHistoryID(databaseController.getInstance().getLargestHistoryID());
mPreferencesModel.setHistorySize(databaseController.getInstance().getLargestHistoryID());
m_history_model = new historyDataModel();
m_data_model = new dataModel();
m_preference_model = new preferenceDataModel(app_context);
m_image_cache_model = new imageCacheModel();
m_data_model.initializeBookmarks();
}
public void initializeListData(){
mPreferencesModel.initSuggestions();
m_data_model.initSuggestions();
if(!status.sHistoryStatus)
{
mPreferencesModel.initializeHistory(databaseController.getInstance().selectHistory(0,constants.START_LIST_SIZE));
m_history_model.onTrigger(dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY, Arrays.asList(databaseController.getInstance().selectHistory(0,constants.FETCHABLE_LIST_SIZE), databaseController.getInstance().getLargestHistoryID(),databaseController.getInstance().getLargestHistoryID()));
}
else
{
@ -51,115 +53,99 @@ public class dataController
}
}
/*Saving Preferences*/
/*Recieving History*/
public Object invokeHistory(dataEnums.eHistoryCommands p_commands, List<Object> p_data){
if(p_commands.equals(dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY)){
int m_history_size = (int)m_history_model.onTrigger(dataEnums.eHistoryCommands.M_HISTORY_SIZE,null);
return m_history_model.onTrigger(p_commands, Collections.singletonList(databaseController.getInstance().selectHistory(m_history_size+1,constants.FETCHABLE_LIST_SIZE)));
}else {
return m_history_model.onTrigger(p_commands, p_data);
}
}
public void setString(String valueKey, String value){
mPreferencesModel.setString(valueKey, value);
}
public void setBool(String valueKey, boolean value){
if(mPreferencesModel!=null){
mPreferencesModel.setBool(valueKey, value);
}
}
public void setInt(String valueKey, int value)
{
mPreferencesModel.setInt(valueKey, value);
/*Recieving Images*/
public Object invokeImageCache(dataEnums.eImageCacheCommands p_commands, List<Object> p_data){
return m_image_cache_model.onTrigger(p_commands, p_data);
}
/*Recieving Preferences*/
public String getString(String valueKey, String valueDefault){
return mPreferencesModel.getString(valueKey, valueDefault);
}
public boolean getBool(String valueKey, boolean valueDefault){
return mPreferencesModel.getBool(valueKey, valueDefault);
}
public int getInt(String valueKey, int valueDefault){
return mPreferencesModel.getInt(valueKey, valueDefault);
}
public float getFloat(String valueKey, int valueDefault){
return mPreferencesModel.getFloat(valueKey, valueDefault);
public Object invokePrefs(dataEnums.ePreferencesCommands p_commands, List<Object> p_data){
return m_preference_model.onTrigger(p_commands, p_data);
}
public void clearAllPrefs(){
mPreferencesModel.clearPrefs();
}
/*Recieving History*/
public ArrayList<historyRowModel> getHistory() {
return mPreferencesModel.getmHistory();
}
public void addHistory(String url,String title) {
mPreferencesModel.addHistory(url);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void updateSuggestionURL(String url,String title) {
url = helperMethod.removeLastSlash(url);
mPreferencesModel.updateSuggestionURL(url,title,false);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void addSuggesion(String url,String title) {
url = helperMethod.removeLastSlash(url);
mPreferencesModel.addSuggenstions(url,title,false);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void removeHistory(String url){
mPreferencesModel.removeHistory(url);
}
public void clearHistory(){
mPreferencesModel.clearHistory();
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void loadMoreHistory(){
ArrayList<historyRowModel> history = databaseController.getInstance().selectHistory(mPreferencesModel.getmHistory().size()-1,constants.MAX_LIST_SIZE);
if(history.size()>0){
mPreferencesModel.loadMoreHistory(history);
}
activityContextManager.getInstance().getHistoryController().updateHistory();
}
/*Recieving Bookmarks*/
public ArrayList<bookmarkRowModel> getBookmark(){
return mPreferencesModel.getBookmark();
return m_data_model.getBookmark();
}
public void addBookmark(String url,String title){
mPreferencesModel.addBookmark(url,title);
m_data_model.addBookmark(url,title);
}
public void clearBookmark(){
mPreferencesModel.clearBookmark();
m_data_model.clearBookmark();
}
/*Recieving Suggestions*/
public ArrayList<historyRowModel> getSuggestions(){
return mPreferencesModel.getmSuggestions();
}
public void clearSuggestions(){
mPreferencesModel.clearSuggestion();
return m_data_model.getmSuggestions();
}
/*Recieving Tabs*/
public ArrayList<tabRowModel> getTab(){
return mPreferencesModel.getTab();
return m_data_model.getTab();
}
public void addTab(geckoSession mSession,boolean isHardCopy){
mPreferencesModel.addTabs(mSession,isHardCopy);
m_data_model.addTabs(mSession,isHardCopy);
}
public void clearTabs(){
mPreferencesModel.clearTab();
m_data_model.clearTab();
}
public void closeTab(geckoSession session){
mPreferencesModel.closeTab(session);
m_data_model.closeTab(session);
}
public void moveTabToTop(geckoSession session){
mPreferencesModel.moveTabToTop(session);
m_data_model.moveTabToTop(session);
}
public tabRowModel getCurrentTab(){
return mPreferencesModel.getCurrentTab();
return m_data_model.getCurrentTab();
}
public int getTotalTabs(){
return mPreferencesModel.getTotalTabs();
return m_data_model.getTotalTabs();
}
public void updateSuggestionURL(String url,String title) {
url = helperMethod.removeLastSlash(url);
m_data_model.updateSuggestionURL(url,title,false);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
public void addSuggesion(String url,String title) {
url = helperMethod.removeLastSlash(url);
m_data_model.addSuggenstions(url,title,false);
activityContextManager.getInstance().getHomeController().onSuggestionUpdate();
}
}

View File

@ -0,0 +1,17 @@
package com.darkweb.genesissearchengine.dataManager;
public class dataEnums
{
/*Settings Manager*/
public enum eHistoryCommands {
M_GET_HISTORY, M_ADD_HISTORY, M_REMOVE_HISTORY, M_CLEAR_HISTORY, M_LOAD_MORE_HISTORY, M_INITIALIZE_HISTORY, M_HISTORY_SIZE
}
public enum ePreferencesCommands{
M_SET_STRING, M_SET_BOOL, M_SET_INT, M_SET_FLOAT, M_GET_STRING, M_GET_BOOL, M_GET_INT, M_GET_FLOAT, M_CLEAR_PREFS
}
public enum eImageCacheCommands{
M_SET_IMAGE, M_GET_IMAGE, M_CLEAR_IMAGE, M_CLEAR_OLD_IMAGES
}
}

View File

@ -1,109 +1,27 @@
package com.darkweb.genesissearchengine.dataManager;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.util.Log;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.bookmarkManager.bookmarkRowModel;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.appManager.homeManager.geckoSession;
import com.darkweb.genesissearchengine.appManager.tabManager.tabRowModel;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.net.URI;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@SuppressLint("CommitPrefEdits")
class dataModel
{
private SharedPreferences mPrefs;
private SharedPreferences.Editor mEdit;
private ArrayList<historyRowModel> mHistory = new ArrayList<>();
private ArrayList<bookmarkRowModel> mBookmarks = new ArrayList<>();
private ArrayList<tabRowModel> mTabs = new ArrayList<>();
private ArrayList<historyRowModel> mSuggestions = new ArrayList<>();
private Map<String, Boolean> mHistoryCache = new HashMap<>();
private Map<String, historyRowModel> mSuggestionCache = new HashMap<>();
private int mMaxHistoryId = 0;
private int mHistorySize = 0;
dataModel(AppCompatActivity app_context){
mPrefs = PreferenceManager.getDefaultSharedPreferences(app_context);
mEdit = mPrefs.edit();
}
void clearPrefs(){
mEdit.clear();
mEdit.apply();
}
/*Prefs Data Model*/
void setString(String valueKey, String value){
mEdit.putString(valueKey, value);
mEdit.apply();
}
String getString(String valueKey, String valueDefault){
return mPrefs.getString(valueKey, valueDefault);
}
void setBool(String valueKey, boolean value){
mEdit.putBoolean(valueKey, value);
mEdit.apply();
}
boolean getBool(String valueKey, boolean valueDefault){
return mPrefs.getBoolean(valueKey, valueDefault);
}
void setInt(String valueKey, int value){
mEdit.putInt(valueKey, value);
mEdit.apply();
}
int getInt(String valueKey, int valueDefault){
return mPrefs.getInt(valueKey, valueDefault);
}
void setFloat(String valueKey, int value){
mEdit.putInt(valueKey, value);
mEdit.apply();
}
int getFloat(String valueKey, int valueDefault){
return mPrefs.getInt(valueKey, valueDefault);
}
/*List History*/
void initializeHistory(ArrayList<historyRowModel> history){
this.mHistory = history;
if(!status.sHistoryStatus){
initializeCache(history);
}else {
clearHistory();
}
}
private void initializeCache(ArrayList<historyRowModel> history){
for(int count=0;count<=history.size()-1;count++){
mHistoryCache.put(history.get(count).getmHeader(),true);
historyRowModel tempSuggestion = new historyRowModel(history.get(count).getTitle(),history.get(count).getmHeader(),-1);
tempSuggestion.updateTitle(tempSuggestion.getmHeader());
tempSuggestion.updateURL(history.get(count).getmHeader());
addSuggenstions(tempSuggestion.getmHeader(),tempSuggestion.getTitle(),true);
mSuggestionCache.put(helperMethod.removeLastSlash(history.get(count).getmHeader()),tempSuggestion);
}
}
void updateSuggestionURL(String url, String newURL,boolean isLoading){
if(url.length()>1500){
return;
@ -114,8 +32,7 @@ class dataModel
if(model!=null){
mSuggestionCache.remove(url);
if(!newURL.equals("loading"))
model.updateHeader(newURL);
model.updateTitle(model.getmHeader());
model.setHeader(newURL);
mSuggestionCache.put(url,model);
}
@ -123,7 +40,7 @@ class dataModel
params[0] = newURL;
params[1] = url;
if(newURL.length()>0 && !isLoading){
databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
// databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
}
}
void addSuggenstions(String url, String title,boolean isLoading){
@ -135,10 +52,11 @@ class dataModel
url = helperMethod.urlWithoutPrefix(url);
historyRowModel tempModel = mSuggestionCache.get(url);
if(tempModel==null){
historyRowModel model = new historyRowModel(title,url,-1);
mSuggestionCache.put(url,model);
mSuggestions.add(0,mSuggestionCache.get(url));
if(tempModel==null) {
historyRowModel model = new historyRowModel(title, url, -1);
mSuggestionCache.put(url, model);
mSuggestions.add(0, mSuggestionCache.get(url));
}
else {
updateSuggestionURL(url,title,isLoading);
@ -148,87 +66,7 @@ class dataModel
params[0] = title;
params[1] = url;
if(title.length()>0 && !isLoading){
databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
}
}
void addHistory(String url) {
if(url.length()>1500){
return;
}
url = helperMethod.removeLastSlash(url);
url = helperMethod.urlWithoutPrefix(url);
@SuppressLint("SimpleDateFormat") SimpleDateFormat d_form = new SimpleDateFormat("dd MMMM | hh:mm a");
String date = d_form.format(new Date());
Object url_exists = mHistoryCache.get(url);
if(url_exists!=null){
for(int count = 0; count< mHistory.size(); count++){
historyRowModel model = mHistory.get(count);
if(model.getmHeader().equals(url)){
mHistory.remove(count);
mHistory.add(0,model);
databaseController.getInstance().execSQL("UPDATE history SET date = '"+date+"' WHERE id="+model.getmId(),null);
break;
}
}
historyRowModel model = mSuggestionCache.get(url);
if(model!=null){
for(int e=0;e<mSuggestions.size();e++){
String temp_url = helperMethod.removeLastSlash(model.getmHeader());
temp_url = helperMethod.urlWithoutPrefix(temp_url);
if(temp_url.equals(mSuggestions.get(e).getmDescription())){
mSuggestions.remove(e);
}
}
mSuggestions.add(0,model);
}
return;
}
if(mHistorySize > constants.MAX_LIST_DATA_SIZE)
{
databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.MAX_LIST_DATA_SIZE /2)+")",null);
}
String[] params = new String[1];
params[0] = url;
mMaxHistoryId = mMaxHistoryId +1;
mHistorySize += 1;
databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ mMaxHistoryId +",DateTime('now'),?,'');",params);
mHistory.add(0,new historyRowModel(url,date, mMaxHistoryId));
mHistoryCache.put(url,true);
}
ArrayList<historyRowModel> getmHistory() {
return mHistory;
}
void setMaxHistoryID(int max_history_id){
this.mMaxHistoryId = max_history_id;
}
void setHistorySize(int history_size){
this.mHistorySize = history_size;
}
void removeHistory(String url) {
mHistoryCache.remove(url);
mHistorySize -= 1;
}
void clearHistory() {
mHistory.clear();
mHistoryCache.clear();
mSuggestionCache.clear();
mSuggestions.clear();
initSuggestions();
}
void loadMoreHistory(ArrayList<historyRowModel> history){
this.mHistory.addAll(history);
for(int count=0;count<=history.size()-1;count++){
mHistoryCache.put(history.get(count).getmHeader(),true);
//databaseController.getInstance().execSQL("UPDATE history SET title = ? , date = DateTime('now') WHERE url = ?",params);
}
}
@ -245,7 +83,6 @@ class dataModel
if(mBookmarks.size()> constants.MAX_LIST_SIZE)
{
databaseController.getInstance().execSQL("delete from bookmark where id="+ mBookmarks.get(mBookmarks.size()-1).getmId(),null);
mBookmarks.remove(mHistory.size()-1);
}
if(mBookmarks.size()>0)

View File

@ -0,0 +1,174 @@
package com.darkweb.genesissearchengine.dataManager;
import com.darkweb.genesissearchengine.appManager.databaseManager.databaseController;
import com.darkweb.genesissearchengine.appManager.historyManager.historyRowModel;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
public class historyDataModel {
private int m_max_history_Id = 0;
private int m_history_size = 0;
private ArrayList<historyRowModel> m_history;
private Map<Integer, historyRowModel> m_history_cache;
public historyDataModel(){
m_history = new ArrayList<>();
m_history_cache = new HashMap<>();
}
void initializeHistory(ArrayList<historyRowModel> history, int pMaxHistoryId, int pHistorySize){
m_max_history_Id = pMaxHistoryId;
m_history_size = pHistorySize;
this.m_history = history;
if(!status.sHistoryStatus){
initializeCache(history);
}else {
clearHistory();
}
}
private void initializeCache(ArrayList<historyRowModel> history){
for(int count=0;count<=history.size()-1;count++){
historyRowModel tempSuggestion = new historyRowModel(history.get(count).getHeader(),history.get(count).getHeader(),-1);
tempSuggestion.setURL(history.get(count).getHeader());
m_history_cache.put(history.get(count).getID(),tempSuggestion);
}
}
private ArrayList<historyRowModel> getHistory() {
return m_history;
}
private void removeDuplicateURLFromHistory(int p_id, String p_url){
for (int m_count = 0; m_count < m_history.size(); m_count++) {
historyRowModel m_temp_model = m_history.get(m_count);
if(m_temp_model==null)
continue;
if (m_temp_model.getDescription().equals(p_url)) {
if(m_temp_model.getID()==p_id){
if(m_count>0){
m_history.remove(m_count);
m_history.add(0, m_temp_model);
}
}else {
Calendar calendar = Calendar.getInstance();
int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
Calendar cal = Calendar.getInstance();
cal.setTime(m_history.get(m_count).getDate());
if (dayOfYear == cal.get(Calendar.DAY_OF_YEAR)) {
databaseController.getInstance().execSQL("DELETE FROM history WHERE id = " + m_history.get(m_count).getID(), null);
m_history_cache.remove(m_history.get(m_count).getID());
m_history.remove(m_count);
m_count = m_count-1;
}
}
}
}
}
private int addHistory(String p_url,String p_header, int p_id) {
if(p_url.length()>1500 || p_url.equals("about:blank") || p_header.equals("$TITLE")){
return p_id;
}
p_url = helperMethod.removeLastSlash(p_url);
p_url = helperMethod.urlWithoutPrefix(p_url);
Object url_exists = m_history_cache.get(p_id);
if(url_exists!=null){
m_history_cache.get(p_id).setHeader(p_header);
m_history_cache.get(p_id).setURL(p_url);
removeDuplicateURLFromHistory(p_id, p_url);
String[] params = new String[2];
params[0] = p_url;
params[1] = p_header;
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
databaseController.getInstance().execSQL("UPDATE history SET date = '" + m_date + "' , url = ? , title = ? WHERE id="+p_id,params);
return p_id;
}else {
if(m_history_size > constants.MAX_LIST_DATA_SIZE)
{
databaseController.getInstance().execSQL("DELETE FROM history WHERE id IN (SELECT id FROM History ORDER BY id ASC LIMIT "+(constants.MAX_LIST_DATA_SIZE /2)+")",null);
}
if(p_header.equals("loading")){
p_header = p_url;
}
String[] params = new String[2];
params[0] = p_url;
params[1] = p_header;
m_max_history_Id = m_max_history_Id +1;
m_history_size += 1;
String m_date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Calendar.getInstance().getTime());
databaseController.getInstance().execSQL("INSERT INTO history(id,date,url,title) VALUES("+ m_max_history_Id +",'" + m_date + "',?,?);",params);
m_history.add(0,new historyRowModel(p_header,p_url, m_max_history_Id));
m_history_cache.put(m_max_history_Id,m_history.get(0));
removeDuplicateURLFromHistory(m_max_history_Id, p_url);
return m_max_history_Id;
}
}
private void removeHistory(int p_id){
databaseController.getInstance().execSQL("DELETE FROM history WHERE id = "+p_id,null);
databaseController.getInstance().selectHistory(0,constants.FETCHABLE_LIST_SIZE);
m_history_cache.remove(p_id);
m_history_size -= 1;
}
private void clearHistory(){
databaseController.getInstance().execSQL("DELETE FROM history WHERE 1 ",null);
m_history.clear();
m_history_cache.clear();
}
private boolean loadMoreHistory(ArrayList<historyRowModel> p_history){
this.m_history.addAll(p_history);
for(int count=0;count<=p_history.size()-1;count++){
m_history_cache.put(p_history.get(count).getID(),p_history.get(0));
}
return p_history.size() > 0;
}
public Object onTrigger(dataEnums.eHistoryCommands p_commands, List<Object> p_data){
if(p_commands == dataEnums.eHistoryCommands.M_GET_HISTORY){
return getHistory();
}
else if(p_commands == dataEnums.eHistoryCommands.M_ADD_HISTORY){
return addHistory((String) p_data.get(0),(String) p_data.get(2), (int)p_data.get(3));
}
else if(p_commands == dataEnums.eHistoryCommands.M_REMOVE_HISTORY){
removeHistory((int) p_data.get(0));
}
else if(p_commands == dataEnums.eHistoryCommands.M_CLEAR_HISTORY){
clearHistory();
}
else if(p_commands == dataEnums.eHistoryCommands.M_LOAD_MORE_HISTORY){
return loadMoreHistory((ArrayList<historyRowModel>) p_data.get(0));
}
else if(p_commands == dataEnums.eHistoryCommands.M_INITIALIZE_HISTORY){
initializeHistory((ArrayList<historyRowModel>) p_data.get(0), (int)p_data.get(1), (int)p_data.get(2));
}
else if(p_commands == dataEnums.eHistoryCommands.M_HISTORY_SIZE){
return m_history.size();
}
return null;
}
}

View File

@ -0,0 +1,48 @@
package com.darkweb.genesissearchengine.dataManager;
import android.widget.ImageView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class imageCacheModel {
private Map<String, ImageView> m_image_cache;
public imageCacheModel(){
m_image_cache = new HashMap<>();
}
public void saveImage(String p_host_url, ImageView p_image){
m_image_cache.put(p_host_url, p_image);
}
public ImageView getImage(String p_host_url){
return m_image_cache.get(p_host_url);
}
public void clearImages(){
}
public void clearOldImages(){
}
public Object onTrigger(dataEnums.eImageCacheCommands p_commands, List<Object> p_data){
if(p_commands == dataEnums.eImageCacheCommands.M_SET_IMAGE){
saveImage((String) p_data.get(0), (ImageView)p_data.get(1));
}
else if(p_commands == dataEnums.eImageCacheCommands.M_GET_IMAGE){
return getImage((String) p_data.get(0));
}
else if(p_commands == dataEnums.eImageCacheCommands.M_CLEAR_IMAGE){
clearImages();
}
else if(p_commands == dataEnums.eImageCacheCommands.M_CLEAR_OLD_IMAGES){
clearOldImages();
}
return null;
}
}

View File

@ -0,0 +1,86 @@
package com.darkweb.genesissearchengine.dataManager;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import androidx.appcompat.app.AppCompatActivity;
import java.util.List;
public class preferenceDataModel {
private SharedPreferences mPrefs;
private SharedPreferences.Editor mEdit;
public preferenceDataModel(AppCompatActivity app_context){
mPrefs = PreferenceManager.getDefaultSharedPreferences(app_context);
mEdit = mPrefs.edit();
}
void clearPrefs(){
mEdit.clear();
mEdit.apply();
}
void setString(String valueKey, String value){
mEdit.putString(valueKey, value);
mEdit.apply();
}
String getString(String valueKey, String valueDefault){
return mPrefs.getString(valueKey, valueDefault);
}
void setBool(String valueKey, boolean value){
mEdit.putBoolean(valueKey, value);
mEdit.apply();
}
boolean getBool(String valueKey, boolean valueDefault){
return mPrefs.getBoolean(valueKey, valueDefault);
}
void setInt(String valueKey, int value){
mEdit.putInt(valueKey, value);
mEdit.apply();
}
int getInt(String valueKey, int valueDefault){
return mPrefs.getInt(valueKey, valueDefault);
}
void setFloat(String valueKey, int value){
mEdit.putInt(valueKey, value);
mEdit.apply();
}
int getFloat(String valueKey, int valueDefault){
return mPrefs.getInt(valueKey, valueDefault);
}
public Object onTrigger(dataEnums.ePreferencesCommands p_commands, List<Object> p_data){
if(p_commands == dataEnums.ePreferencesCommands.M_GET_BOOL){
return getBool((String)p_data.get(0), (boolean)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_GET_INT){
return getInt((String)p_data.get(0), (int)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_GET_STRING){
return getString((String)p_data.get(0), (String)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_GET_FLOAT){
return getFloat((String)p_data.get(0), (int)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_SET_BOOL){
setBool((String)p_data.get(0), (boolean)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_SET_INT){
setInt((String)p_data.get(0), (int)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_SET_STRING){
setString((String)p_data.get(0), (String)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_SET_FLOAT){
setFloat((String)p_data.get(0), (int)p_data.get(1));
}
else if(p_commands == dataEnums.ePreferencesCommands.M_CLEAR_PREFS){
clearPrefs();
}
return null;
}
}

View File

@ -0,0 +1,67 @@
package com.darkweb.genesissearchengine.helperManager;
import android.content.Context;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
public class OnSwipeTouchListener implements OnTouchListener {
private final GestureDetector gestureDetector;
public OnSwipeTouchListener (Context ctx){
gestureDetector = new GestureDetector(ctx, new GestureListener());
}
@Override
public boolean onTouch(View v, MotionEvent event) {
return gestureDetector.onTouchEvent(event);
}
private final class GestureListener extends SimpleOnGestureListener {
private static final int SWIPE_THRESHOLD = 100;
private static final int SWIPE_VELOCITY_THRESHOLD = 100;
@Override
public boolean onDown(MotionEvent e) {
onTap();
return true;
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
boolean result = false;
try {
float diffY = e2.getY() - e1.getY();
float diffX = e2.getX() - e1.getX();
if (Math.abs(diffX) > Math.abs(diffY)) {
if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) {
if (diffX > 0) {
onSwipeRight();
} else {
onSwipeLeft();
}
result = true;
}
}
else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) {
if (diffY > 0) {
onSwipeBottom();
} else {
onSwipeTop();
}
result = true;
}
} catch (Exception exception) {
exception.printStackTrace();
}
return result;
}
}
public void onSwipeRight() {
}
public void onSwipeLeft() {
}
public void onSwipeTop() {
}
public void onSwipeBottom() {
}
public void onTap() {
}
}

View File

@ -41,12 +41,12 @@ public class autoCompleteAdapter extends ArrayAdapter<historyRowModel> {
TextView myTv = v.findViewById( R.id.hintCompletionUrl);
if (customerNameLabel != null) {
if(customer.getTitle().equals(strings.EMPTY_STR)){
customerNameLabel.setText(customer.getmHeader() );
if(customer.getHeader().equals(strings.EMPTY_STR)){
customerNameLabel.setText(customer.getHeader() );
}else {
customerNameLabel.setText(customer.getTitle());
customerNameLabel.setText(customer.getHeader());
}
myTv.setText(customer.getmDescription());
myTv.setText(customer.getDescription());
}
}
return v;
@ -64,7 +64,7 @@ public class autoCompleteAdapter extends ArrayAdapter<historyRowModel> {
return strings.EMPTY_STR;
}
historyRowModel model = (historyRowModel)(resultValue);
String str = model.getmHeader();
String str = model.getHeader();
return str;
}
@Override
@ -77,11 +77,11 @@ public class autoCompleteAdapter extends ArrayAdapter<historyRowModel> {
}
if(!customer.getTitle().equals("$TITLE") && customer.getmHeader().length()>2 && customer.getmDescription().toLowerCase().length()>2 && (customer.getmHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getmDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){
if(!customer.getHeader().equals("$TITLE") && customer.getHeader().length()>2 && customer.getDescription().toLowerCase().length()>2 && (customer.getHeader().toLowerCase().contains(constraint.toString().toLowerCase()) || customer.getDescription().toLowerCase().contains(constraint.toString().toLowerCase()))){
Log.i("memememe:","memememe:"+constraint.toString().toLowerCase().replace("https://","").replace("http://",""));
Log.i("memememe1:","memememe2:"+customer.getmDescription().replace("https://","").replace("http://",""));
Log.i("memememe1:","memememe2:"+customer.getDescription().replace("https://","").replace("http://",""));
if(!constraint.toString().toLowerCase().replace("https://","").replace("http://","").equals(customer.getmDescription().replace("https://","").replace("http://",""))){
if(!constraint.toString().toLowerCase().replace("https://","").replace("http://","").equals(customer.getDescription().replace("https://","").replace("http://",""))){
suggestions.add(customer);
}
}

View File

@ -8,6 +8,6 @@ public class eventObserver
{
public interface eventListener
{
void invokeObserver(List<Object> data, enums.etype event_type);
Object invokeObserver(List<Object> data, enums.etype event_type);
}
}

View File

@ -34,6 +34,7 @@ import androidx.core.content.ContextCompat;
import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.example.myapplication.BuildConfig;
import java.io.File;
@ -45,6 +46,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.net.ssl.HttpsURLConnection;
@ -142,7 +144,7 @@ public class helperMethod
}
public static void rateApp(AppCompatActivity context){
dataController.getInstance().setBool(keys.IS_APP_RATED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.darkweb.genesissearchengine")));
}
@ -155,6 +157,24 @@ public class helperMethod
.startChooser();
}
public static void shareApp(AppCompatActivity context, String p_share, String p_title) {
ShareCompat.IntentBuilder.from(context)
.setType("text/plain")
.setChooserTitle("Hi! Check out this Awesome URL | " + p_title)
.setSubject("Hi! Check out this Awesome URL | " + p_title)
.setText("Website URL | " + p_share)
.startChooser();
}
public static void shareURL(AppCompatActivity context, String p_share) {
ShareCompat.IntentBuilder.from(context)
.setType("text/plain")
.setChooserTitle("Hi! Check out these Awesome URLS")
.setSubject("Hi! Check out these Awesome URL")
.setText("Website URL | " + p_share)
.startChooser();
}
public static void openDownloadFolder(AppCompatActivity context)
{
Intent intent = new Intent(DownloadManager.ACTION_VIEW_DOWNLOADS);

View File

@ -3,7 +3,6 @@ package com.darkweb.genesissearchengine.pluginManager;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.appcompat.app.AppCompatActivity;
import com.crashlytics.android.Crashlytics;
import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
@ -53,9 +52,6 @@ class analyticManager
/*Helper Methods*/
void logUser(){
Crashlytics.setUserIdentifier(mUniqueID);
Crashlytics.setUserEmail(constants.USER_EMAIL);
Crashlytics.setUserName(mUniqueID);
}
}

View File

@ -1,12 +1,8 @@
package com.darkweb.genesissearchengine.pluginManager;
import androidx.appcompat.app.AppCompatActivity;
import com.crashlytics.android.Crashlytics;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import io.fabric.sdk.android.Fabric;
class fabricManager
{
/*Private Variables*/
@ -23,7 +19,5 @@ class fabricManager
}
private void initialize(){
Fabric.with(mAppContext, new Crashlytics());
mEvent.invokeObserver(null,null);
}
}

View File

@ -559,42 +559,6 @@ class messageManager
});
}
private void torBanned()
{
/*isDialogDismissed = true;
popup_instance.setDialogStyle(CFAlertDialog.CFAlertStyle.BOTTOM_SHEET)
.setTitle(app_context.getString(R.string.BANNED_TITLE)
.setBackgroundColor(app_context.getResources().getColor(R.color.holo_dark_gray_alpha))
.setTextColor(app_context.getResources().getColor(R.color.black))
.setMessage(app_context.getString(R.string.BANNED_DESC)
.onDismissListener(dialog -> is_popup_open = false)
.onDismissListener(dialog -> startHome());
String btn_text;
if(status.sGateway){
btn_text = "Disable Tor Gateway";
}
else {
btn_text = "Enable Tor Gateway";
}
popup_instance.addButton(btn_text, -1, -1, CFAlertDialog.CFAlertActionStyle.POSITIVE, CFAlertDialog.CFAlertActionAlignment.JUSTIFIED, (tempDialog, which) ->
{
isDialogDismissed = false;
onFinish();
event.invokeObserver(Collections.singletonList(!status.sGateway), enums.etype.connect_vpn);
});*/
}
private void startHome(){
if(!isDialogDismissed && data.get(0)==null){
event.invokeObserver(null, enums.etype.start_home);
}
is_popup_open = false;
}
void onReset(){
onFinish();
dialog_main = null;
@ -672,10 +636,6 @@ class messageManager
versionWarning();
break;
case tor_banned:
torBanned();
break;
case download_file_long_press:
downloadFileLongPress();
break;

View File

@ -7,13 +7,17 @@ import android.os.Build;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.constants.*;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
import org.mozilla.gecko.PrefsHelper;
import org.torproject.android.service.TorService;
import org.torproject.android.service.OrbotService;
import org.torproject.android.service.util.Prefs;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.Arrays;
import static org.torproject.android.service.TorServiceConstants.ACTION_START;
class orbotManager
@ -33,7 +37,7 @@ class orbotManager
}
public void initialize(AppCompatActivity app_context, eventObserver.eventListener event){
initNotification(dataController.getInstance().getInt(keys.NOTIFICATION_STATUS,1));
initNotification((Integer) dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_GET_INT, Arrays.asList(keys.NOTIFICATION_STATUS,1)));
}
void startOrbot(Context context){
@ -41,7 +45,7 @@ class orbotManager
orbotLocalConstants.sIsManualBridge = status.sGatewayManual;
this.mAppContext = context;
Prefs.putBridgesEnabled(status.sGatewayManual|status.sGatewayAuto);
Intent mServiceIntent = new Intent(context, TorService.class);
Intent mServiceIntent = new Intent(context, OrbotService.class);
mServiceIntent.setAction(ACTION_START);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(mServiceIntent);
@ -60,19 +64,26 @@ class orbotManager
orbotLocalConstants.sNotificationStatus = status;
}
void enableTorNotification(){
TorService.getServiceObject().enableNotification();
OrbotService.getServiceObject().enableNotification();
}
void disableTorNotification(){
TorService.getServiceObject().disableNotification();
OrbotService.getServiceObject().disableNotification();
}
void enableTorNotificationNoBandwidth(){
TorService service = TorService.getServiceObject();
OrbotService service = OrbotService.getServiceObject();
if(service!=null){
TorService.getServiceObject().enableTorNotificationNoBandwidth();
OrbotService.getServiceObject().enableTorNotificationNoBandwidth();
}
}
public void updateBridges(boolean p_status){
Prefs.putBridgesEnabled(p_status);
}
public void updateVPN(boolean p_status){
Prefs.putUseVpn(p_status);
}
/*------------------------------------------------------- POST TASK HANDLER -------------------------------------------------------*/
void setProxy(String url){

View File

@ -1,8 +1,7 @@
package com.darkweb.genesissearchengine.pluginManager;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import com.darkweb.genesissearchengine.appManager.activityContextManager;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController;
@ -11,11 +10,12 @@ import com.darkweb.genesissearchengine.constants.keys;
import com.darkweb.genesissearchengine.constants.status;
import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataController;
import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.helperManager.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod;
//import org.torproject.android.service.wrapper.orbotLocalConstants;
import org.torproject.android.service.wrapper.orbotLocalConstants;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@ -150,57 +150,68 @@ public class pluginController
}
public void updateCookiesStatus(){
}
public void updateBridges(boolean p_status){
orbotManager.getInstance().updateBridges(p_status);
}
public void updateVPN(boolean p_status){
orbotManager.getInstance().updateVPN(p_status);
}
/*------------------------------------------------ CALLBACK LISTENERS------------------------------------------------------------*/
/*Ad Manager*/
private class admobCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
mHomeController.onSetBannerAdMargin();
return null;
}
}
/*Analytics Manager*/
private class analyticCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
mAnalyticManager.logUser();
return null;
}
}
/*Fabric Manager*/
private class fabricCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
return null;
}
}
/*Firebase Manager*/
private class firebaseCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
return null;
}
}
/*Lang Manager*/
private class langCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
return null;
}
}
/*Onion Proxy Manager*/
private class orbotCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
return null;
}
}
@ -218,14 +229,14 @@ public class pluginController
/*Message Manager*/
private class messageCallback implements eventObserver.eventListener{
@Override
public void invokeObserver(List<Object> data, enums.etype event_type)
public Object invokeObserver(List<Object> data, enums.etype event_type)
{
if(event_type.equals(enums.etype.welcome))
{
mHomeController.onLoadURL(data.get(0).toString());
}
else if(event_type.equals(enums.etype.cancel_welcome)){
dataController.getInstance().setBool(keys.IS_WELCOME_ENABLED,false);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_WELCOME_ENABLED,false));
}
else if(event_type.equals(enums.etype.ignore_abi)){
//mHomeController.ignoreAbiError();
@ -240,7 +251,7 @@ public class pluginController
}
}
else if(event_type.equals(enums.etype.clear_history)){
dataController.getInstance().clearHistory();
dataController.getInstance().invokeHistory(dataEnums.eHistoryCommands.M_CLEAR_HISTORY ,null);
mContextManager.getHistoryController().onclearData();
mHomeController.onClearSession();
dataController.getInstance().clearTabs();
@ -260,7 +271,7 @@ public class pluginController
}
}
else if(event_type.equals(enums.etype.app_rated)){
dataController.getInstance().setBool(keys.IS_APP_RATED,true);
dataController.getInstance().invokePrefs(dataEnums.ePreferencesCommands.M_SET_BOOL, Arrays.asList(keys.IS_APP_RATED,true));
}
else if(event_type.equals(enums.etype.download_file)){
mHomeController.onDownloadFile();
@ -285,6 +296,7 @@ public class pluginController
mHomeController.initTab();
activityContextManager.getInstance().getTabController().finish();
}
return null;
}
}
}

146
app/src/main/jni/Android.mk Normal file
View File

@ -0,0 +1,146 @@
# Copyright (C) 2009 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
LOCAL_PATH := $(call my-dir)
ROOT_PATH := $(LOCAL_PATH)
EXTERN_PATH := $(LOCAL_PATH)/../../../../external
########################################################
## pdnsd library
########################################################
include $(CLEAR_VARS)
PDNSD_SOURCES := $(wildcard $(LOCAL_PATH)/pdnsd/src/*.c)
LOCAL_MODULE := pdnsd
LOCAL_SRC_FILES := $(PDNSD_SOURCES:$(LOCAL_PATH)/%=%)
LOCAL_CFLAGS := -Wall -O2 -I$(LOCAL_PATH)/pdnsd -DHAVE_STPCPY
include $(BUILD_EXECUTABLE)
########################################################
## libancillary
########################################################
include $(CLEAR_VARS)
ANCILLARY_SOURCE := fd_recv.c fd_send.c
LOCAL_MODULE := libancillary
LOCAL_CFLAGS := -O2 -I$(LOCAL_PATH)/libancillary
LOCAL_SRC_FILES := $(addprefix libancillary/, $(ANCILLARY_SOURCE))
include $(BUILD_STATIC_LIBRARY)
########################################################
## tun2socks
########################################################
include $(CLEAR_VARS)
LOCAL_CFLAGS := -std=gnu99
LOCAL_CFLAGS += -DBADVPN_THREADWORK_USE_PTHREAD -DBADVPN_LINUX -DBADVPN_BREACTOR_BADVPN -D_GNU_SOURCE
LOCAL_CFLAGS += -DBADVPN_USE_SELFPIPE -DBADVPN_USE_EPOLL
LOCAL_CFLAGS += -DBADVPN_LITTLE_ENDIAN -DBADVPN_THREAD_SAFE
LOCAL_CFLAGS += -DNDEBUG -DANDROID
LOCAL_CFLAGS += -DTUN2SOCKS_JNI
LOCAL_CFLAGS += -DPSIPHON
LOCAL_STATIC_LIBRARIES := libancillary
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH)/libancillary \
$(EXTERN_PATH)/badvpn/ \
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv4 \
$(EXTERN_PATH)/badvpn/lwip/src/include/ipv6 \
$(EXTERN_PATH)/badvpn/lwip/src/include \
$(EXTERN_PATH)/badvpn/lwip/custom \
TUN2SOCKS_SOURCES := \
base/BLog_syslog.c \
system/BReactor_badvpn.c \
system/BSignal.c \
system/BConnection_unix.c \
system/BTime.c \
system/BUnixSignal.c \
system/BNetwork.c \
flow/StreamRecvInterface.c \
flow/PacketRecvInterface.c \
flow/PacketPassInterface.c \
flow/StreamPassInterface.c \
flow/SinglePacketBuffer.c \
flow/BufferWriter.c \
flow/PacketBuffer.c \
flow/PacketStreamSender.c \
flow/PacketPassConnector.c \
flow/PacketProtoFlow.c \
flow/PacketPassFairQueue.c \
flow/PacketProtoEncoder.c \
flow/PacketProtoDecoder.c \
socksclient/BSocksClient.c \
tuntap/BTap.c \
lwip/src/core/timers.c \
lwip/src/core/udp.c \
lwip/src/core/memp.c \
lwip/src/core/init.c \
lwip/src/core/pbuf.c \
lwip/src/core/tcp.c \
lwip/src/core/tcp_out.c \
lwip/src/core/netif.c \
lwip/src/core/def.c \
lwip/src/core/mem.c \
lwip/src/core/tcp_in.c \
lwip/src/core/stats.c \
lwip/src/core/inet_chksum.c \
lwip/src/core/ipv4/icmp.c \
lwip/src/core/ipv4/igmp.c \
lwip/src/core/ipv4/ip4_addr.c \
lwip/src/core/ipv4/ip_frag.c \
lwip/src/core/ipv4/ip4.c \
lwip/src/core/ipv4/autoip.c \
lwip/src/core/ipv6/ethip6.c \
lwip/src/core/ipv6/inet6.c \
lwip/src/core/ipv6/ip6_addr.c \
lwip/src/core/ipv6/mld6.c \
lwip/src/core/ipv6/dhcp6.c \
lwip/src/core/ipv6/icmp6.c \
lwip/src/core/ipv6/ip6.c \
lwip/src/core/ipv6/ip6_frag.c \
lwip/src/core/ipv6/nd6.c \
lwip/custom/sys.c \
tun2socks/tun2socks.c \
base/DebugObject.c \
base/BLog.c \
base/BPending.c \
system/BDatagram_unix.c \
flowextra/PacketPassInactivityMonitor.c \
tun2socks/SocksUdpGwClient.c \
udpgw_client/UdpGwClient.c
LOCAL_MODULE := tun2socks
LOCAL_LDLIBS := -ldl -llog
LOCAL_SRC_FILES := $(addprefix ../../../../external/badvpn/, $(TUN2SOCKS_SOURCES))
##include $(BUILD_EXECUTABLE)
include $(BUILD_SHARED_LIBRARY)
# Import cpufeatures
$(call import-module,android/cpufeatures)

View File

@ -0,0 +1,3 @@
APP_ABI := armeabi-v7a x86 arm64-v8a x86_64
APP_PLATFORM := android-16
APP_STL := c++_static

View File

@ -0,0 +1,139 @@
This library provide an easy interface to the black magic that can be done
on Unix domain sockets, like passing file descriptors from one process to
another.
Programs that uses this library should include the ancillary.h header file.
Nothing else is required.
All functions of this library require the following header:
#include <ancillary.h>
At this time, the only ancillary data defined by the Single Unix
Specification (v3) is file descriptors.
Passing file descriptors
int ancil_send_fd(socket, file_descriptor)
int socket: the Unix socket
int file_descriptor: the file descriptor
Return value: 0 for success, -1 for failure.
Sends one file descriptor on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
int ancil_recv_fd(socket, file_descriptor)
int socket: the Unix socket
int *file_descriptor: pointer to the returned file descriptor
Return value: 0 for success, -1 for failure
Receives one file descriptor from a socket.
In case of success, the file descriptor is stored in the integer pointed
to by file_descriptor.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The behavior is undefined if the recv_fd does not match a send_fd* on the
other side.
int ancil_send_fds(socket, file_descriptors, num_file_descriptors)
int socket: the Unix socket
const int *file_descriptors: array of file descriptors
unsigned num_file_descriptors: number of file descriptors
Return value: 0 for success, -1 for failure
Sends several file descriptors on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
The maximum number of file descriptors that can be sent using this
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
overflow, probably a stack corruption.
int ancil_recv_fds(socket, file_descriptors, num_file_descriptors)
int socket: the Unix socket
int *file_descriptors: return array of file descriptors
unsigned num_file_descriptors: number of file descriptors
Return value: number of received fd for success, -1 for failure
Receives several file descriptors from a socket, no more than
num_file_descriptors.
In case of success, the received file descriptors are stored in the array
pointed to by file_descriptors.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The maximum number of file descriptors that can be received using this
function is ANCIL_MAX_N_FDS; the behavior is undefined in case of
overflow, probably a stack corruption.
The behavior is undefined if the recv_fds does not match a send_fd* on
the other side, or if the number of received file descriptors is more than
num_file_descriptors.
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
int socket: the Unix socket
const int *fds: array of file descriptors
unsigned num: number of file descriptors
void *buffer: buffer to hold the system data structures
Return value: 0 for success, -1 for failure
Sends several file descriptors on a socket.
In case of failure, errno is set; the possible values are the ones of the
sendmsg(2) system call.
The buffer argument must point to a memory area large enough to hold the
system data structures, see ANCIL_FD_BUFFER.
int ancil_send_fds_with_buffer(socket, fds, num, buffer)
int socket: the Unix socket
int *fds: return array of file descriptors
unsigned num: number of file descriptors
void *buffer: buffer to hold the system data structures
Return value: number of received fd for success, -1 for failure
Receives several file descriptors from a socket, no more than
num_file_descriptors.
In case of success, the received file descriptors are stored in the array
pointed to by file_descriptors.
In case of failure, errno is set; the possible values are the ones of the
recvmsg(2) system call.
The behavior is undefined if the recv_fds does not match a send_fd* on
the other side, or if the number of received file descriptors is more than
num_file_descriptors.
The buffer argument must point to a memory area large enough to hold the
system data structures, see ANCIL_FD_BUFFER.
ANCIL_MAX_N_FDS
Maximum number of file descriptors that can be sent with the sent_fds and
recv_fds functions. If you have to send more at once, use the
*_with_buffer versions. The value is enough to send "quite a few" file
descriptors.
ANCIL_FD_BUFFER(n)
int n: number of file descriptors
Expands to a structure data type large enough to hold the system data
structures for n file descriptors. So the address of a variable declared
of type ANCIL_FD_BUFFER(n) is suitable as the buffer argument for
*_with_buffer on n file descriptors.
To use this macro, you need <sys/types.h> and <sys/socket.h>. Bevare: with
Solaris, the _XPG4_2 macro must be defined before sys/socket is included.
Tuning the compilation
This library is designed to be included in projects, not installed in
/usr/lib. If your project does not use some of the functions, the
TUNE_OPTS variable in the Makefile allows not to build them. It is a list
of proprocessor options:
-DNDEBUG: turn assertions off (see assert(3))
-DSPARE_SEND_FDS: do not build ancil_send_fds
-DSPARE_SEND_FD: do not build ancil_send_fd
-DSPARE_RECV_FDS: do not build ancil_recv_fds
-DSPARE_RECV_FD: do not build ancil_recv_fd

View File

@ -0,0 +1,21 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,73 @@
###########################################################################
# libancillary - black magic on Unix domain sockets
# (C) Nicolas George
# Makefile - guess what
###########################################################################
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
CC=gcc
CFLAGS=-Wall -g -O2
LDFLAGS=
LIBS=
AR=ar
RANLIB=ranlib
RM=rm
CP=cp
MKDIR=mkdir
TAR=tar
GZIP=gzip -9
NAME=libancillary
DISTRIBUTION=API COPYING Makefile ancillary.h fd_send.c fd_recv.c test.c
VERSION=0.9.1
OBJECTS=fd_send.o fd_recv.o
TUNE_OPTS=-DNDEBUG
#TUNE_OPTS=-DNDEBUG \
-DSPARE_SEND_FDS -DSPARE_SEND_FD -DSPARE_RECV_FDS -DSPARE_RECV_FD
.c.o:
$(CC) -c $(CFLAGS) $(TUNE_OPTS) $<
all: libancillary.a
libancillary.a: $(OBJECTS)
$(AR) cr $@ $(OBJECTS)
$(RANLIB) $@
fd_send.o: ancillary.h
fd_recv.o: ancillary.h
test: test.c libancillary.a
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) -L. test.c -lancillary $(LIBS)
clean:
-$(RM) -f *.o *.a test
dist:
$(MKDIR) $(NAME)-$(VERSION)
$(CP) $(DISTRIBUTION) $(NAME)-$(VERSION)
$(TAR) -cf - $(NAME)-$(VERSION) | $(GZIP) > $(NAME)-$(VERSION).tar.gz
$(RM) -rf $(NAME)-$(VERSION)

View File

@ -0,0 +1,131 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* ancillary.c - public header
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ANCILLARY_H__
#define ANCILLARY_H__
#ifdef __cplusplus
extern "C" {
#endif
/***************************************************************************
* Start of the readable part.
***************************************************************************/
#define ANCIL_MAX_N_FDS 960
/*
* Maximum number of fds that can be sent or received using the "esay"
* functions; this is so that all can fit in one page.
*/
extern int
ancil_send_fds_with_buffer(int, const int *, unsigned, void *);
/*
* ancil_send_fds_with_buffer(sock, n_fds, fds, buffer)
*
* Sends the file descriptors in the array pointed by fds, of length n_fds
* on the socket sock.
* buffer is a writeable memory area large enough to hold the required data
* structures.
* Returns: -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fds_with_buffer(int, int *, unsigned, void *);
/*
* ancil_recv_fds_with_buffer(sock, n_fds, fds, buffer)
*
* Receives *n_fds file descriptors into the array pointed by fds
* from the socket sock.
* buffer is a writeable memory area large enough to hold the required data
* structures.
* Returns: -1 and errno in case of error, the actual number of received fd
* in case of success
*/
#define ANCIL_FD_BUFFER(n) \
struct { \
struct cmsghdr h; \
int fd[n]; \
}
/* ANCIL_FD_BUFFER(n)
*
* A structure type suitable to be used as buffer for n file descriptors.
* Requires <sys/socket.h>.
* Example:
* ANCIL_FD_BUFFER(42) buffer;
* ancil_recv_fds_with_buffer(sock, 42, my_fds, &buffer);
*/
extern int
ancil_send_fds(int, const int *, unsigned);
/*
* ancil_send_fds(sock, n_fds, fds)
*
* Sends the file descriptors in the array pointed by fds, of length n_fds
* on the socket sock.
* n_fds must not be greater than ANCIL_MAX_N_FDS.
* Returns: -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fds(int, int *, unsigned);
/*
* ancil_recv_fds(sock, n_fds, fds)
*
* Receives *n_fds file descriptors into the array pointed by fds
* from the socket sock.
* *n_fds must not be greater than ANCIL_MAX_N_FDS.
* Returns: -1 and errno in case of error, the actual number of received fd
* in case of success.
*/
extern int
ancil_send_fd(int, int);
/* ancil_recv_fd(sock, fd);
*
* Sends the file descriptor fd on the socket sock.
* Returns : -1 and errno in case of error, 0 in case of success.
*/
extern int
ancil_recv_fd(int, int *);
/* ancil_send_fd(sock, &fd);
*
* Receives the file descriptor fd from the socket sock.
* Returns : -1 and errno in case of error, 0 in case of success.
*/
#ifdef __cplusplus
}
#endif
#endif /* ANCILLARY_H__ */

View File

@ -0,0 +1,98 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* fd_send.c - receiving file descriptors
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _XPG4_2 /* Solaris sucks */
# define _XPG4_2
#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <assert.h>
#if defined(__FreeBSD__)
# include <sys/param.h> /* FreeBSD sucks */
#endif
#include "ancillary.h"
int
ancil_recv_fds_with_buffer(int sock, int *fds, unsigned n_fds, void *buffer)
{
struct msghdr msghdr;
char nothing;
struct iovec nothing_ptr;
struct cmsghdr *cmsg;
int i;
nothing_ptr.iov_base = &nothing;
nothing_ptr.iov_len = 1;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &nothing_ptr;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_control = buffer;
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
cmsg = CMSG_FIRSTHDR(&msghdr);
cmsg->cmsg_len = msghdr.msg_controllen;
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
for(i = 0; i < n_fds; i++)
((int *)CMSG_DATA(cmsg))[i] = -1;
if(recvmsg(sock, &msghdr, 0) < 0)
return(-1);
for(i = 0; i < n_fds; i++)
fds[i] = ((int *)CMSG_DATA(cmsg))[i];
n_fds = (msghdr.msg_controllen - sizeof(struct cmsghdr)) / sizeof(int);
return(n_fds);
}
#ifndef SPARE_RECV_FDS
int
ancil_recv_fds(int sock, int *fd, unsigned n_fds)
{
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
assert(n_fds <= ANCIL_MAX_N_FDS);
return(ancil_recv_fds_with_buffer(sock, fd, n_fds, &buffer));
}
#endif /* SPARE_RECV_FDS */
#ifndef SPARE_RECV_FD
int
ancil_recv_fd(int sock, int *fd)
{
ANCIL_FD_BUFFER(1) buffer;
return(ancil_recv_fds_with_buffer(sock, fd, 1, &buffer) == 1 ? 0 : -1);
}
#endif /* SPARE_RECV_FD */

View File

@ -0,0 +1,92 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* fd_send.c - sending file descriptors
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _XPG4_2 /* Solaris sucks */
# define _XPG4_2
#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <assert.h>
#if defined(__FreeBSD__)
# include <sys/param.h> /* FreeBSD sucks */
#endif
#include "ancillary.h"
int
ancil_send_fds_with_buffer(int sock, const int *fds, unsigned n_fds, void *buffer)
{
struct msghdr msghdr;
char nothing = '!';
struct iovec nothing_ptr;
struct cmsghdr *cmsg;
int i;
nothing_ptr.iov_base = &nothing;
nothing_ptr.iov_len = 1;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &nothing_ptr;
msghdr.msg_iovlen = 1;
msghdr.msg_flags = 0;
msghdr.msg_control = buffer;
msghdr.msg_controllen = sizeof(struct cmsghdr) + sizeof(int) * n_fds;
cmsg = CMSG_FIRSTHDR(&msghdr);
cmsg->cmsg_len = msghdr.msg_controllen;
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
for(i = 0; i < n_fds; i++)
((int *)CMSG_DATA(cmsg))[i] = fds[i];
return(sendmsg(sock, &msghdr, 0) >= 0 ? 0 : -1);
}
#ifndef SPARE_SEND_FDS
int
ancil_send_fds(int sock, const int *fds, unsigned n_fds)
{
ANCIL_FD_BUFFER(ANCIL_MAX_N_FDS) buffer;
assert(n_fds <= ANCIL_MAX_N_FDS);
return(ancil_send_fds_with_buffer(sock, fds, n_fds, &buffer));
}
#endif /* SPARE_SEND_FDS */
#ifndef SPARE_SEND_FD
int
ancil_send_fd(int sock, int fd)
{
ANCIL_FD_BUFFER(1) buffer;
return(ancil_send_fds_with_buffer(sock, &fd, 1, &buffer));
}
#endif /* SPARE_SEND_FD */

View File

@ -0,0 +1,112 @@
/***************************************************************************
* libancillary - black magic on Unix domain sockets
* (C) Nicolas George
* test.c - testing and example program
***************************************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/socket.h>
#include "ancillary.h"
void child_process(int sock)
{
int fd;
int fds[3], nfds;
char b[] = "This is on the received fd!\n";
if(ancil_recv_fd(sock, &fd)) {
perror("ancil_recv_fd");
exit(1);
} else {
printf("Received fd: %d\n", fd);
}
write(fd, b, sizeof(b));
close(fd);
sleep(2);
nfds = ancil_recv_fds(sock, fds, 3);
if(nfds < 0) {
perror("ancil_recv_fds");
exit(1);
} else {
printf("Received %d/3 fds : %d %d %d.\n", nfds,
fds[0], fds[1], fds[2]);
}
}
void parent_process(int sock)
{
int fds[2] = { 1, 2 };
if(ancil_send_fd(sock, 1)) {
perror("ancil_send_fd");
exit(1);
} else {
printf("Sent fd.\n");
}
sleep(1);
if(ancil_send_fds(sock, fds, 2)) {
perror("ancil_send_fds");
exit(1);
} else {
printf("Sent two fds.\n");
}
}
int main(void)
{
int sock[2];
if(socketpair(PF_UNIX, SOCK_STREAM, 0, sock)) {
perror("socketpair");
exit(1);
} else {
printf("Established socket pair: (%d, %d)\n", sock[0], sock[1]);
}
switch(fork()) {
case 0:
close(sock[0]);
child_process(sock[1]);
break;
case -1:
perror("fork");
exit(1);
default:
close(sock[1]);
parent_process(sock[0]);
wait(NULL);
break;
}
return(0);
}

View File

@ -0,0 +1,58 @@
Most of pdnsd was written by Thomas Moestl (tmoestl@gmx.net).
In the "par" versions large parts of the code have been revised
and several features have been added by Paul Rombouts.
Small parts of this program are based on code that was taken from nmap (IP
checksumming), the isdn4k-utils (ippp interface uptest), glibc 2.1.2 (some
definitions for kernel 2.2.x missing in 2.0 glibcs) and FreeBSD
(SIZEOF_ADDR_IFREQ in netdev.c).
nmap was written by Fyodor. The insd4k-utils were written by Fritz Elfert and
others. The GNU C library (glibc) is copyright by the Free Software
Foundation.
The following people have contributed code:
Andrew M. Bishop contributed support for server labels
Carsten Block contributed 'configure'-able rc scripts
Stephan Boettcher contributed the SCHEME= option.
P.J. Bostley contributed patches to get pdnsd working on
alpha
Frank Elsner contributed rc script fixes
Christian Engstler contributed patches for SuSE compatability
Bjoern Fischer contributed code to make pdnsd leave the case of names
in the cache unchanged
Torben Janssen contributed RedHat rc scripts
Olaf Kirch contributed a security fix for the run_as()
function
Bernd Leibing contributed fixes to the spec file.
Sourav K. Mandal contributed the autoconf/automake code, gdbm
caching facility and many suggestions
Markus Mohr contributed Debian rc scripts
Alexandre Nunes contributed autoconf fixes
Wolfgang Ocker contributed the server_ip option
Soenke J. Peters contributed patches and suggestions for RedHat
compatability
Roman Shterenzon contributed many helpful hints and patches for
FreeBSD compatability.
Andreas Steinmetz contributed the code for the query_port_start and
query_port_end options (which I changed slightly,
so blame any breakage on me ;)
Marko Stolle contributed the contrib/pdnsd_update.pl script that
makes pdnsd usable in a DHCP setup.
Lyonel Vincent extended the serve_aliases option to support an
arbitrary number of aliases
Paul Wagland contributed a patches for bind9-compatability
and for some memory leaks on error paths.
Sverker Wiberg contributed IPv6 build fixes
Michael Wiedmann contributed the pdnsd-ctl.8 man page.
Ron Yorston contributed the dev-uptest for Linux ppp dial-
on-demand devices
Nikita V. Youshchenko contributed extensions to the "if" uptest
Mahesh T. Pai contributed the pdnsd.8 man page.
Nikola Kotur contributed the Slackware start-up script.
Kiyo Kelvin Lee contributed a patch for Cygwin support.
Rodney Brown contributed a patch for Darwin (Apple Mac OS X) support.
Jan-Marek Glogowski contributed a patch implementing the "use_nss" option.
Please look into the THANKS file for people who helped me in various ways on
this project.
If this list is incomplete, pease drop me a mail!

View File

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -0,0 +1,26 @@
A small part of the pdnsd source is licensed under the following BSD-style
license:
Copyright (C) 2001 Thomas Moestl
This file is part of the pdnsd package.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,161 @@
2000-02-15
Version 0.2. First working alpha with the extended feature set.
2000-02-16
Version 0.3 with many bugfixes, better standard conformity and
some new features.
2000-02-17
Did a lint on the code, implemented soft timeouts, again bugfixes,
drastically reduced cache memory requirements, implemented local
records.
Version 0.4 released.
2000-02-19
Recursive query finally implemented. Version 0.5 out.
2000-02-20
Various bugfixes. The server now always tries to get an AA answer
if possible; this implies recursion. This is to deal better with
caching servers that may return incomplete results on * queries.
This may be a little sub-optimal since it may not take the full
effect of caching, but it is the only real possibility of getting
complete records.
Redid the deps in the makefile for now.
Version is now 0.6.
2000-02-21
Another set of bugfixes. Version is 0.6.1.
2000-02-22
Another set of bugfixes. It should stabilize by now. Answer compression
is there finally. Version is therefore up again, 0.7 by now.
2000-02-23
Minor bugfixes, isdn interface uptest added. The new record types as of
rfc1700 are implemented, but as a compile-time option, since normally
there is no need to waste space for them.
Version is 0.7.1.
2000-02-24
Version 0.7.2 with all rrs up to KX (36). #define DNS_NEW_RRS in
config.h and (re)compile if you want to use them. Delete the cache
file before using a version with this option changed!
NSAP-PTR does NOT WORK (any incoming answer containing it may cause
a format error) because it is ill-designed (see TODO). Never mind, it
is officially deprecated anyway.
The secure DNS extension record types defined in RFC 2065 (KEY, SIG,
NXT) are cached only and therefore useless.
2000-02-26
Version 0.8 with parallel query (and probably new bugs) introduced.
2000-02-27
Version 0.8.1 with minor bugfixes on the new features.
2000-02-27
Version 0.8.5 with authority support and the usual bugifxes. Some issues
with standard conformity were also fixed (wow, two versions a day).
2000-02-28
Implemented caching of non-authoritative records. This allows better
usage of other caching name servers. This may return non-authoritative
records to any non-wildcard query. If a wildcard query arrives, we
always look for authoritative records, so we do if the non-authoritative
answer does not contain at least one answering record to the query.
This fixes the sub-optimal behaviour since 0.6.
Version is therefore up to 0.8.7 (0.8.6 was also released today
containing bugfixes)
2000-02-29
Better thread support, avoiding deadlocks in signal handling. The cost
is unfortunately one more thread.
New option server_port in config file.
Version is 0.8.8.
2000-03-01
Nailed a renitent memory leak bug to the wall (shame, what a trivial
mistake). Also improved handling of error conditions slightly.
Version is 0.8.9.
2000-03-01
Cache code cleanup. The development of the non-parallel query code
is discontinued, although it still works. If you want serial query,
just set PAR_QUERIES to 1.
Additional information finally implemented.
We are up to 0.9.
2000-03-02
Fixed a DoS possibility.
More rfc compatability fixups and a smarter resolver logic.
Version 0.9.1
2000-03-02
Added the source section to the config file handling. This allows to
source your /etc/hosts file. Version 0.9.2.
2000-03-02
Avoiding double additional records now. Version 0.9.3.
2000-03-09
Fixed some REALLY STUPID bugs. Uuummph, thought it was finished.
However, the number of bugs remaining is always n+1...
Anyway, we are up to 0.9.4. Hope that there are no mean bugs left.
2000-03-14
Added another uptest, exec. See README for details. Also grained the
cache size finer (it's now specified in kB). Version 0.9.5
2000-04-07
Fixed some really stupid bugs, what else? Version is 0.9.6
To be more exact: fixed misc bugs, cleaned up hash.c and cache.c
2000-04-20
Again fixed some bugs, version is now 0.9.7.
2000-04-29
Fixed a build problem caused by some missing #defines in glibc2.0 and a
minor bug.
Version is up to 0.9.8
2000-04-30
Fixed some unclean C code and did a general C lint. Thanks to Byrial
Jensen for pointing out some issues. Now using stricter compiler flags.
Also replaced the daemon() call in main.c for improved portability.
Pre-Released 0.9.9p1
2000-05-03
Released 0.9.9p2 with the changes of 0.9.9p1, Documentation updates,
bugfixes, and the Red Hat rc scripts contributed by Torben Janssen.
Also, the meaning of the command line option -v has changed.
There is a new config file option "lean_query" that is on by
default. It is an optimization, so please look in the docs when
updating whether you want it switched on or not.
Removed the long-dead serial query code from the distribution tree.
Some resolvers seem to be broken somehow in a respect that it cares
about order in which the records appear. In particular, it wants
cname to appear before other records. Ok, so it be...
2000-05-04
Save all names in lower case in the rrs.
Tidying up the source tree.
The long-awaited cache structure changes have been started. Please
delete you cache files before using this new release.
2000-05-05
Fixed several bugs in the old and in the new source tree.
Use time_t instead of long for internal time storage for compatibility.
2000-05-06
Version 0.9.10.
This fixes a bug in uptest=if. Red Hat and configuration fixes
suggested by Soeren J. Peters were included.
2000-05-08
Version 0.9.11
This fixes a locally exploitable security problem (pdnsd.cache was
world-writeable). This is actually a one-line fix; for a description of
possible dangers, please refer to the html documentation.
Thanks to Alan Swanson for reporting.

View File

@ -0,0 +1,190 @@
The installation instructions are in doc/html/doc.html and doc/txt/manual.txt.
The system requirements are listed in doc/html/index.html and doc/txt/intro.txt.
I recommend using the html version.
Following are generic installation instructions for autoconf programs.
I strongly recommend to read the Installation section in the docs!
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -0,0 +1,40 @@
SUBDIRS = src doc contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
# The sample configuration is handled in doc/Makefile.am
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
if test `whoami` = "root"; then \
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
fi
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
chmod 0750 "$(DESTDIR)$(cachedir)"
dist-hook: $(PACKAGE).spec.in
sed -e '/^%{!?distro: %define distro /c\
%if 0%{!?distro:1}\
%if "%{_vendor}" == "redhat"\
%define distro RedHat\
%else\
%if "%{_vendor}" == "suse"\
%define distro SuSE\
%else\
%if "%{_vendor}" == "SuSE"\
%define distro SuSE\
%endif\
%endif\
%endif\
%endif' \
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
-e 's:[@]VERSION[@]:$(VERSION):g' \
-e 's:[@]fullversion[@]:$(fullversion):g' \
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
-e 's:[@]def_id[@]:$(PACKAGE):g' \
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec

View File

@ -0,0 +1,734 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/PKGBUILD.in \
$(srcdir)/config.h.in $(srcdir)/file-list.base.in \
$(srcdir)/pdnsd.spec.in $(top_srcdir)/configure AUTHORS \
COPYING ChangeLog INSTALL NEWS THANKS TODO acconfig.h compile \
depcomp install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = pdnsd.spec file-list.base PKGBUILD
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build_alias = @build_alias@
builddir = @builddir@
cachedir = @cachedir@
datadir = @datadir@
datarootdir = @datarootdir@
def_id = @def_id@
distribution = @distribution@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
fullversion = @fullversion@
host_alias = @host_alias@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
packagerelease = @packagerelease@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
specbuild = @specbuild@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
thread_CFLAGS = @thread_CFLAGS@
threadlib = @threadlib@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = src doc contrib
EXTRA_DIST = version ChangeLog.old COPYING.BSD README.par README.par.old PKGBUILD
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps) $(top_srcdir)/acconfig.h
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
pdnsd.spec: $(top_builddir)/config.status $(srcdir)/pdnsd.spec.in
cd $(top_builddir) && $(SHELL) ./config.status $@
file-list.base: $(top_builddir)/config.status $(srcdir)/file-list.base.in
cd $(top_builddir) && $(SHELL) ./config.status $@
PKGBUILD: $(top_builddir)/config.status $(srcdir)/PKGBUILD.in
cd $(top_builddir) && $(SHELL) ./config.status $@
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am:
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am:
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am:
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
ctags-recursive install-am install-data-am install-strip \
tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-hook dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-generic distclean-hdr \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-hook install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \
tags-recursive uninstall uninstall-am
# The sample configuration is handled in doc/Makefile.am
install-data-hook:
$(mkinstalldirs) "$(DESTDIR)$(cachedir)"
test -f "$(DESTDIR)$(cachedir)/pdnsd.cache" || \
touch "$(DESTDIR)$(cachedir)/pdnsd.cache"
if test `whoami` = "root"; then \
chown $(def_id) "$(DESTDIR)$(cachedir)/pdnsd.cache"; \
chown $(def_id) "$(DESTDIR)$(cachedir)"; \
fi
chmod 0640 "$(DESTDIR)$(cachedir)/pdnsd.cache"
chmod 0750 "$(DESTDIR)$(cachedir)"
dist-hook: $(PACKAGE).spec.in
sed -e '/^%{!?distro: %define distro /c\
%if 0%{!?distro:1}\
%if "%{_vendor}" == "redhat"\
%define distro RedHat\
%else\
%if "%{_vendor}" == "suse"\
%define distro SuSE\
%else\
%if "%{_vendor}" == "SuSE"\
%define distro SuSE\
%endif\
%endif\
%endif\
%endif' \
-e 's:[@]PACKAGE[@]:$(PACKAGE):g' \
-e 's:[@]VERSION[@]:$(VERSION):g' \
-e 's:[@]fullversion[@]:$(fullversion):g' \
-e 's:[@]packagerelease[@]:$(packagerelease):g' \
-e 's:[@]cachedir[@]:/var/cache/$(PACKAGE):g' \
-e 's:[@]def_id[@]:$(PACKAGE):g' \
$(PACKAGE).spec.in > $(distdir)/$(PACKAGE).spec
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

324
app/src/main/jni/pdnsd/NEWS Normal file
View File

@ -0,0 +1,324 @@
Version 1.2.9a fixes a bug in the 1.2.9 release that causes a build failure when
pdnsd is configured with --enable-strict-rfc2181. Unless you use this option to
compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
Version 1.2.9 has support for many additional RR types, in particular those
needed for DNSSEC (though no support for the DNSSEC protocol itself yet in
pdnsd). Caching data structures are now more efficient when they only store the
most commonly used RR types. Fine-grained configurability over which RR-types
are cache-able. Pdnsd now has support for EDNS (Extension mechanisms for DNS),
although its usefulness is currently limited to enabling UDP messages larger
than 512 bytes. Defining local TXT records in the configuration file is now
supported. A new configuration option provides a fix in case the query uptest
fails due to remote servers ignoring empty queries. Several bugs have been fixed
including a UDP socket descriptor leak that affected the FreeBSD platform, and
an IPv6 port binding bug.
Version 1.2.8 implements support for automatic discovery of root servers.
There are also some improvements in the resolver and a new default setting for
the neg_rrs_pol configuration option.
Version 1.2.7-par fixes some security problems. It contains a fix for a
"dangling pointer" bug that could cause pdnsd to crash when it received a long
reply. It also addresses some of the issues raised in the CERT vulnerability
note VU#800113 by making the default of query_port_start equal to 1024, thereby
ensuring that source ports are randomly selected by the pdnsd resolver in the
range 1024-65535. This release also fixes problems with compiling pdnsd for the
ARM architecture and for the Darwin platform (Max OS X). There are a number of
(minor) new features. pdnsd now supports "include" files, essentially
configuration files that only contain definitions for local records. It is now
possible to define interactively, using pdnsd-ctl, any local record that can be
defined in a configuration file.
Version 1.2.6-par has an upgraded license: GPL version 3.
A bug has been fixed which which caused pdnsd to handle NXDOMAIN replies
inefficiently when configured with neg_domain_pol=on. Also the code for the
ping test has been fixed, which was broken for 64-bit systems. A new option
randomize_servers can be used to give each server in a section of the
configuration file an equal chance of being queried. The new options reject,
reject_policy and reject_recursively make it possible to check for the presence
of certain IP addresses in the replies of name servers and to correct some types
of unwanted replies or to censor these IP addresses.
The pdnsd-ctl 'add a' and 'add aaaa' commands now allow multiple IP addresses to
be specified for the same name. There are some further improvements to pdnsd's
recursive resolver.
Version 1.2.5-par introduces a new query method: udp_tcp. With this method a UDP
query is tried first and, if the UDP answer is truncated, the query is repeated
using TCP, which is the behaviour that seems to be recommended by the DNS
standards. There is a new configuration option use_nss, which can be turned off
to prevent lengthy timeouts and stalls in certain situations. A bug has been
fixed which could cause pdnsd to crash if debug output was generated before the
debug output stream was properly initialized.
In version 1.2.4-par a memory leak and a minor buffer-overflow problem have been
fixed. There is now a fix for some situations that would previously cause pdnsd
to exit prematurely (such as ACPI S3 sleep or trying to attach strace to pdnsd).
Time intervals specified in the configuration file can now be expressed in
minutes, hours, days and weeks as well as seconds. Support for Apple Mac OS X
v10.4 Tiger has been improved. The "pdnsd-ctl status" command now also provides
some information about the status of the running threads. There are some further
improvements in the debugging information provided by pdnsd.
TCP-query support is now compiled in by default (but can still be disabled using
the configure option --disable-tcp-queries).
In version 1.2.3-par the "pdnsd-ctl empty-cache" command can be provided with an
include/exclude list, allowing the user to specify a selection of names to be
removed, instead of emptying the cache completely.
Additional improvements: pdnsd should now remain responsive while executing the
"pdnsd-ctl empty-cache" command. With the query_method=tcp_udp option pdnsd will
now also try a UDP query after a TCP connection times out, which should allow
pdnsd to resolve the same names with query_method=tcp_udp as with
query_method=udp_only, although perhaps with an occasional delay.
"pdnsd-ctl config" or "pdnsd-ctl server" commands should now run without delays,
even if pdnsd is performing ping or query uptests at the time. A problem with
resolving certain names using root servers has been fixed.
Version 1.2.2-par has a number of important portability improvements. A bug has
been fixed that prevented pdnsd from compiling successfully on some 64 bit
architectures. The code for determining endianness (most significant or least
significant byte first) should now be more portable. This release has
(experimental) support for the Darwin (Apple Mac OS X) platform. On Linux
systems, the configure script will now try to detect automatically whether the
system implements the Native POSIX Thread Library, but the method used may not
necessarily be foolproof. In addition, the debug features have been improved and
should make it easier to find out why pdnsd considers some queries or replies
malformed.
Version 1.2.1-par has improved support for non-Linux platforms. This release has
(experimental) support for the Cygwin platform, and should also fix some
compilation glitches that have been reported by FreeBSD users.
Version 1.2-par is a new and improved version of pdnsd! Most of the changes
effect the internal workings of pdnsd, but there are also a number of
interesting new features (well, I think they are interesting). Among the bugs
fixed are two rather nasty ones which involve the handling of NXT and NAPTR
records and which can cause pdnsd to crash or abort. The new features include a
new server availability test which can be specified with uptest=query, support
for reading the DNS configuration from resolv.conf files, a new option for
optimizing the use of root servers, a new option that makes defining local
records for reverse resolving easier, support for defining wildcard records, a
new pdnsd-ctl command for reloading the config file without restarting pdnsd,
and a new pdnsd-ctl command for dumping information about the names stored in
the cache.
The documentation has also been updated: there is now a pdnsd.conf man page. For
a more complete list of the changes I'll have to refer you to README.par and the
ChangeLog.
Version 1.1.11a-par contains a fix for FreeBSD users that bypasses a problem
with the macro ENONET, which can cause a compilation failure when it is
undefined. Linux users will notice no difference between 1.1.11a-par and
1.1.11-par.
Version 1.1.11-par has a rather large number of small changes, which are rather
difficult to summarize. Among the bugs fixed are a race condition in the cache
lookup code, a flaw in the code that caused a busy spin when a remote server
answered with "Not Implemented", and problems with the -4 and -6 command-line
options. Among the improvements are an alternative sorting algorithm which
should allow pdnsd to start up faster when reading a large cache file from disk,
automatic mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat
more efficient memory use, better compression of the replies and changes in the
parallel querying algorithm that should improve the chances of catching a reply
from a remote server. For a more complete list of the changes I'll have to
refer you to README.par and the ChangeLog.
Version 1.1.10-par has a new parser for configuration files, completely
rewritten from scratch in C. The main advantages are: (f)lex and yacc/bison are
no longer needed to build pdnsd, more informative error messages instead of
merely "parse error", and string literals no longer need to be enclosed in
quotes in most cases. Furthermore, a bug has been fixed that caused incorrect
IPV6-type PTR records to be generated when sourcing /etc/hosts like files.
There have been other small changes, more details can be found in the ChangeLog.
Version 1.1.9-par adds some missing pieces to the documentation (the pdnsd
manual and the man page for pdnsd-ctl). The changes to the code consist mostly
of optimizations, removal of some size limits due to fixed-size buffers, and
some cleaning up. I've also tried to make the error responses of pdnsd-ctl more
helpful. More details can be found in the ChangeLog.
Version 1.1.8b1-par8 introduces a "delegation-only" feature that may be useful
for blocking Verisign's Sitefinder. The parser for the configuration file now
tolerates domain names missing a dot at the end. I have provided alternative
implementations for some GNU extensions that I used in an effort to make the
code more portable. In particular, the code should build on FreeBSD again. More
details can be found in the README.par file.
Version 1.1.8b1-par7 fixing a number of bugs. I have also reworked some of the
code for adding and removing entries in the cache in an effort to improve
efficiency and stability. More details can be found in the ChangeLog.
Version 1.1.8b1-par6 introduces some further code cleanup. In addition the
documentation has been revised.
Version 1.1.8b1-par5 fixes a troublesome allocation size error that has been
discovered in Thomas Moestl's code. In practice this bug only wastes memory but
it could also potentially lead to memory corruption. Upgrading is
recommended. More details can be found in the ChangeLog.
Version 1.1.8b1-par4 has been released. Due to incompatibilities between
various implementations of the pthread library on Linux systems, problems can
occur with signal handling in pdnsd. The usual symptom is failure by pdnsd to
save the cache to disk, and /var/cache/pdnsd/pdnsd.cache remaining empty. If you
experience this kind of trouble, try reconfiguring with different values for the
new --with-thread-lib option. The allowable values are described in the
documentation.
pdnsd is no longer maintained by Thomas Moestl: I have not had time to maintain
pdnsd for quite a while now, and have been very slow to respond to issues, or
did not respond at all. It is time that I officially announce that pdnsd is no
longer actively maintained; I apologize to all those who reported bugs or asked
questions without receiving any reply. However, Paul A. Rombouts has published a
patch set against the last released version at
http://www.phys.uu.nl/~rombouts/pdnsd.html, which cleans up a lot of code fixes
many bugs.
Version 1.1.7a fixes a reversed assertion that would cause pdnsd to terminate
if used with the ping uptest. No other changes were made.
Version 1.1.7 fixes some problems that might be remotely exploitable to
gain access as the user pdnsd runs as (an unprivileged user by default). To do
this, an attacker needs to control a name server that is queried by pdnsd, and
send a malicious reply to such a query. Upgrading is strongly recommended!
There are also minor bug fixes and stability improvements.
Version 1.1.6 adds the query_port_start and query_port_end options (contributed
by Andreas Steinmetz), that allow confining the ports pdnsd uses for outgoing
queries to a certain range. It also fixes numerous bugs, one of which could
cause pdnsd to hang; update is therefore recommended.
Version 1.1.5 contains a fix for a security bug that would allow local users
that are allowed to use pdnsd-ctl on a running pdnsd server to execute
arbitrary code as the user that pdnsd runs as (or on Linux, when strict_setuid
is not enabled, as the user that started pdnsd). The danger of this is usually
quite limited; the status socket is not enabled by default, it's default
permissions do only allow the user pdnsd runs as to use the socket,
strict_setuid is enabled by default and pdnsd runs as an unprivileged user.
There is also a new configure option, --enable-underscores, that will make
pdnsd allow underscores in domain names. Furthermore, the SRV record handling
has been fixed to allow underscores in any case (this was not allowed
previously, but is required by the RFC). SOA records are not put in the
answer section any more if no answers are found (this violates the RFC's).
It may be put in the authority section in a later version.
There are also various bugfixes in this release.
Upgrade is recommended.
Version 1.1.4 fixes various smaller bugs, and should also improve the cache
write performance especially for larger caches. There are also two new
features: servers can now be given a label (using the label server option)
which can be used to identify them for the pdnsd-ctl server command
(contributed by Andrew M. Bishop), and local records can be marked to make
the domain record authoritative in pdnsd's cache (which means that pdnsd will
assume that records that are not present in the cache for that domain are
non-existent); this is on by default now, and can be controlled using the new
authrec server option).
Version 1.1.3 added contrib/ and had a lot of robustness fixes.
This release addresses a security hole that affects only Linux systems. Due to
a bug in glibc, pdnsd could crash during a port scan. This release contains
a workaround for this, as well as a fix for a deadlock under heavy load
conditions. It also fixes a possible problem that could be triggered by
malicious servers, and contains numerous bug fixes.
A script, contributed by Marko Stolle, makes pdnsd useful in a DHCP setup.
pdnsd also preservers the case of names in the cache, and should work much
better on alpha machines (thanks for the contributions by Bjoern Fischer
and P.J. Bostley that made this possible). New types were dded for rr
sections and pdnsd-ctl.
Upgrade is recommended.
Version 1.1.2 has a fix for a bug that could cause SERVFAIL to be
returned when NXDOMAIN would be appropriate. The bug surfaced only when
pdnsd queried name servers with a behaviour different from BIND's in the
NXDOMAIN case, e.g. pdnsd querying another pdnsd or e.g. djbdns.
Version 1.1.1 fixes a possible race condition in status socket creation.
This race might be used by a local attacker to change the access
permissions of a certain file in /tmp. The risk of this is probably
negligible. The default setup uses a non-privileged user, default mode
0600, and the status socket is disabled normally, so this should be
relatively safe. I don't see any possibility to exploit this, it is
more of a paranoia fix.
There are also some other minor fixes and documentation improvements.
Upgrade is recommended.
Version 1.1.0 introduces negative cacheing, pdnsd-ctl enhancements and
a much improved FreeBSD support. The cache file format has changed from
prior releases. Some configuration defaults have changed, too.
Version 1.0.15 is mostly a bugfix release. It also has a new option:
randomize_recs in the global section.
Version 1.0.14 has a fix in icmp.c that will make it build properly
on FreeBSD and older Linux systems.
Version 1.0.13 has some code cleanup, a fix for the Debian rc install,
and a security fix (contributed by Olaf Kirch): when changing
user and group id, pdnsd did not drop supplementary group IDs that
the original user was member of.
Version 1.0.12 is a bugfix release and contains some security
enhancements. There are also inclusion/exclusion lists for servers
(new options include=, exclude=, policy= in the server
section).
Version 1.0.11 fixes two bugs that might be used for denial-of-service
attacks, upgrading is recommended.
Versions 1.0.9 and 1.0.10 are bugfix releases.
Version 1.0.8 introduces special linux ppp device support contributed
by Ron Yorston, and has some bugfixes.
Version 1.0.7 introduces autoconf support, many new config file options and
the new pdnsd-ctl run-time configuration program.
Version 1.0.6 has another set of bugfixes, in addition to higher compile-
time configurability and UDP query support. It also contains Debian rc
scripts contributed by Markus Mohr.
Version 1.0.5 has some bugfixes and the new "server_ip" option
contributed by Wolfgang Ocker.
Version 1.0.4 introduces the new options run_as, strict_setuid and
paranoid. These new options are optional security enhancements.
Versions 1.0.1, 1.0.2 and 1.0.3 are bugfix releases.
Version 1.0.0 has a lot of changes compared to the 0.9.x tree, but much of
them "under the hood":
- IPv6 support (experimental; compile- and run-time configurable)
- FreeBSD (and such hopefully *BSD) support
- better rfc2181 compatability
- new options:
- serve_aliases in source section
- linkdown_kluge in global section
- max_ttl in global section
- cache-code reorganization, only one unified hash (of variable depth)
- Optimizations & cleanups
- Automatic deps (only interesting for developers ;-)
Version 0.9.11 fixes a locally exploitable security hole (the cache file was
world writeable by default). Please see ChangeLog.old for details.
Version 0.9.10 fixes some bugs and improves build on Red Hat.
Version 0.9.9 contains the rc scripts for Red Hat Linux contributed by Torben
Janssen, in addition to code cleanups and bugfixes.
The meaning of the option -v has changed in this release.
There is also a new config file option "lean_query" that is on by default. It
is an optimization, so please look in the docs when updating whether you want
it switched on or not.
When compiling versions after 0.9.8, you will probably get more
compiler warningsthan before. This is because the C compiler settings
have been made stricter.
Version 0.9.8 fixes a minor bug some build problems with glibc2.0 systems.
The versions 0.9.6 and 0.9.7 are bugfix releases.
Version 0.9.5 introduces uptest=exec, and a modified config file syntax (cache
sizes are now specified in kB).
Version 0.9.4 was the first to be released to the public. For information on
changes, see ChangeLog.

View File

@ -0,0 +1,24 @@
# Package build script for Arch Linux,
# contributed by Alexander Drozdov.
pkgname=@PACKAGE@
pkgver=@VERSION@
pkgrel=@packagerelease@
pkgdesc="pdnsd is a proxy DNS server with permanent caching (the cache contents are written to hard disk on exit) that is designed to cope with unreachable or down DNS servers."
url="http://members.home.nl/p.a.rombouts/pdnsd.html"
license="GPLv3"
depends=()
makedepends=(glibc)
conflicts=()
replaces=()
backup=()
install=
source=(http://members.home.nl/p.a.rombouts/pdnsd/releases/$pkgname-$pkgver-$pkgrel.tar.gz)
md5sums=()
build() {
cd $startdir/src/$pkgname-$pkgver
./configure --prefix=/usr --enable-ipv6 --sysconfdir=/etc --with-distribution=ArchLinux
make || return 1
make DESTDIR=$startdir/pkg install
}

View File

@ -0,0 +1,22 @@
You can find the documentation for pdnsd in the doc/ directory. The html
documentation (which I recommend) is in the doc/html/ subdirectory.
The pure text documentation (which is generated automatically from the
html documentation) is in doc/txt/.
The following documents are available:
index.html / intro.txt Overview, system requirements
doc.html / manual.txt Building, installation and usage instructions
faq.html / faq.txt The FAQ
Share and enjoy!
Thomas <tmoestl@gmx.net>
For news about recent changes in pdnsd the following files may be of
interest to you:
README.par
ChangeLog
NEWS
Last revised: 08 July 2007 by Paul Rombouts

View File

@ -0,0 +1,216 @@
pdnsd version 1.2.9a by Paul Rombouts
=====================================
This file describes the version of pdnsd that I maintain personally and am
making available so other people can enjoy the latest features and fixes. Thomas
Moestl no longer maintains pdnsd himself, so I am effectively the new
maintainer. This README describes the new features in version 1.2. This version
has a rather large number of internal changes and also some new features, which
I am rather pleased with, even if I say so myself. I think the changes are
significant enough to warrant increasing the minor version number from 1.1 to
1.2. The differences between my previous "official" release 1.1.11 and Thomas'
last release 1.1.7a are described in my previous README, which I have renamed
REAME.par.old. In this README I restrict myself to describing changes between
1.1.11 and 1.2.
The main difference between versions 1.2 and 1.2.1, aside from some minor
changes, is that 1.2.1 has (experimental) support for the Cygwin platform.
Version 1.2.2 has further improvements in portability and should in
particular now also compile on the Darwin (Apple Mac OS X) platform.
Version 1.2.4 has some important fixes for a memory leak, a minor buffer-
overflow problem and some situations which could cause pdnsd to exit
prematurely. Note that TCP-query support is now compiled in by default, but can
still be disabled using a configure option.
The main new feature of version 1.2.5 is the new query method "udp_tcp".
Version 1.2.6 has an updated license: GPL version 3. The main new feature of
version 1.2.6 is the "reject" option, which makes it possible to censor or
correct for unwanted IP addresses in replies.
Version 1.2.7 contains an important fix for a "dangling pointer" bug and
attempts to make pdnsd less vulnerable to the issues raised in CERT
vulnerability note VU#800113. It also contains some improvements for defining
local records interactively using the pdnsd-ctl utility.
The main new feature of version 1.2.8 is automatic discovery of root servers,
as well as some minor improvements in the resolver.
Version 1.2.9 among other things supports many addtional RR types, uses data
structures that should be more slightly more memory efficient and has support
for EDNS, which allows DNS UDP messages to be larger than 512 bytes.
Version 1.2.9a is a simple bugfix release that fixes a problem with compiling
1.2.9 after configuring with --enable-strict-rfc2181. Unless you use this option
to compile pdnsd, there is no need to upgrade from 1.2.9 to 1.2.9a.
For instructions how to compile and install pdnsd see doc/html/doc.html or
doc/txt/manual.txt. Note that I am no longer distributing a patch w.r.t. Thomas'
version because the (compressed) patch file is barely smaller than the
(compressed) tar archive.
Here follows a list of some of changes in version 1.2 from a user's perspective.
For a more technical description of some of the changes in the code see the ChangeLog.
For a short history about recent releases have a look at NEWS or doc/html/index.html.
- First of all, two potentially rather nasty bugs have been fixed in the code
for the handling of NXT and NAPTR records. A response from a remote server
containing NXT records (even well-formed ones) will very likely cause pdnsd to
crash. The code for handling NAPTR records contained incorrect ASSERT
statements, which could cause pdnsd to abort in a controlled fashion, but
completely unnecessarily.
- Sampo Lehtinen has remarked that pdnsd sometimes failed to resolve classless
reversed-delegated IP addresses, and that this has something to do with the
fact that pdnsd didn't accept '/' characters in domain names. After reading
some of the relevant RFCs I decided to remove all restrictions on the types
of characters that pdnsd accepts in domain names. Of course for most
applications, there are many characters which don't make sense in domain
names, but I feel that it is the responsibility of the client application to
reject these, not the proxy server.
- At the suggestion of Dan Tihelka, I have expanded to the server_ip= option to
allow the name of an interface to be specified instead of an IP address.
Presently this has been tested on Linux only. Can someone running pdnsd on
*BSD tell me if the code for getting the address of an interface is different
for Linux and BSD-type systems?
- At the suggestion of Juliusz Chroboczek I've added an new server availability
test which can be specified with uptest=query. This can be useful as an
alternative to "uptest=ping" in case the remote server does not respond to
ICMP_ECHO requests at all, which unfortunately is quite common these days.
"uptest=query" causes pdnsd to send an empty query to remote name servers. Any
well-formed response (apart from SERVFAIL) within the timeout period will be
interpreted as a sign that the server is "up".
- Instead of specifying the IP addresses of the name servers that pdnsd should
query in a server section of the config file, you may also specify a
resolv.conf-style file. Preferably this should not be /etc/resolv.conf. If the
contents of the resolv.conf type file changes while pdnsd is running, you can
make pdnsd aware of the changes with the "pdnsd-ctl config" command, see
below. Example:
server {
label=myisp;
file=/etc/ppp/resolv.conf;
timeout=10;
}
- There is a new option for "server" sections in the config file:
root_server=on/off.
In case a server section contains only addresses of root servers, which
usually only give the name servers of top level domains in their reply,
setting root_server=on will enable certain optimizations. This involves using
cached information to reduce queries to the root servers, thus speeding up the
resolving of new names.
- New option for "rr" sections in the config file: reverse=on/off.
If you want a locally defined name to resolve to a numeric address and vice
versa, you can now achieve this by setting reverse=on before defining the A
record, making it unnecessary to define a separate PTR record for the reverse
resolving.
Example:
rr {
name = localhost;
reverse = on;
a = 127.0.0.1;
}
has the same effect as:
rr {
name = localhost;
a = 127.0.0.1;
}
rr {
name = 1.0.0.127.in-addr.arpa;
ptr = localhost;
}
- In rr sections it is now possible to specify a wildcard name, i.e. a name
starting with the label *. The * in a wildcard can match one or more labels in
a queried name, but only whole labels. For example, *.mydomain will match
a.mydomain or www.a.mydomain, but not mydomain. Before you can specify an rr
section with name=*.mydomain you must define some records for mydomain,
typically NS and/or SOA records.
Example:
rr {
name = mydomain;
ns = localhost;
soa = localhost, root.localhost, 42, 86400, 900, 86400, 86400;
}
rr {
name = *.mydomain;
a = 192.168.1.10;
}
- There is a slight backwards compatibility problem which involves the name= and
owner= options in rr sections. The new version does not allow you to place
owner= before name=. On the other hand, you may now freely mix the owner
option with the a,ptr,cname,mx and soa options and define as many records of
this type as you like (including zero).
- pdnsd-ctl has three new commands:
config: Reloads pdnsd's configuration file. This is more efficient than
restarting pdnsd, and should not cause only noticeable interruption in DNS
service. However, some types of configuration changes cannot be put into
effect this way, and you will be prompted to restart pdnsd instead.
empty-cache: Empties the cache completely, freeing all existing entries.
In version 1.2.3 you can specify a selection of entries to delete by providing
a list of include/exclude patterns.
dump: Prints information about all the names stored in the cached. This is
mainly useful for diagnostic purposes.
- There is now a pdnsd.conf(5) man page, describing pdnsd's configuration file.
The man page has been generated from the html documentation using a customized
Perl script.
- New in version 1.2.4: Time intervals in the configuration files can now be
expressed in seconds, minutes, hours, days and weeks, using the suffixes
s,m,h,d,and w.
Example: 2h30m is interpreted as 2*60*60 + 30*60 = 9000 seconds.
- Version 1.2.5 introduces a new configuration option, contributed by Jan-Marek
Glogowski, called "use_nss" which can be turned off to prevent nasty delays in
certain situations.
Besides the query methods "udp_only", "tcp_only" and "tcp_udp" you can now
also specify "udp_tcp", which more closely adheres to the behaviour
recommended by DNS standards.
- Version 1.2.6 introduces the "randomize_servers" and "reject" options. By
setting "randomize_servers" on you can give each server in a server section an
equal chance of being queried, which is useful when resolving from root
servers, for instance. The "reject" option can be used to censor certain IP
addresses or correct for unwanted replies from servers you don't completely
trust.
- Version 1.2.7 contains support for "include" files which can be referenced
from configuration files or read interactively using pdnsd-ctl. These files
can be used to add local definitions to the cache without reconfiguring pdnsd.
The new "pdnsd-ctl eval" command can be used to interactively define local
records that could previously only be defined in configuration files but not
with the "pdnsd-ctl add" command.
- Version 1.2.8 contains support for automatic discovery of root servers.
Instead of supplying a complete list of IP addresses of root servers in a
server section of the configuration file, you need only enter one or two
addresses of name servers which know the names and addresses of the root
servers and set "root_server=discover".
The "neg_rrs_pol" option has a new default setting, which should allow
sensible negative caching of RRs in most situations, even if "proxy_only=on".
- Version 1.2.9 contains support for EDNS (Extension mechanisms for DNS), which
allows UDP messages to be larger than 512 bytes. Whether pdnsd uses EDNS in
outgoing queries is determined by the configuration option "edns_query". If
pdnsd receives a query using EDNS, it will reply using EDNS regardless of the
configuration settings.
Local TXT records can now be defined in the configuration file.
If the query uptest fails due to remote servers ignoring empty queries, this
can now be remedied using the new "query_test_name" config option.
The new features are described in greater detail in the manual doc/html/doc.html
or doc/txt/manual.txt.
Enjoy!
If you have any questions about my version of pdnsd, you can send these
to <p.a.rombouts@home.nl>. Questions about the original (unmaintained) pdnsd
version should be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.

View File

@ -0,0 +1,249 @@
pdnsd maintenance version 1.1.11-par by Paul Rombouts
=======================================================
This file describes the version of pdnsd that I maintain personally and am
making available so other people can enjoy the latest features and fixes.
Thomas Moestl no longer maintains pdnsd himself, so I am effectively the new
maintainer. The current version is 1.1.11-par, which has a rather large number
of small changes. Among the bugs fixed are a race condition in the cache lookup
code, a flaw in the code that caused a busy spin when a remote server answered
with "Not Implemented", and problems with the -4 and -6 command-line options.
Among the improvements are an alternative sorting algorithm which should allow
pdnsd to start up faster when reading a large cache file from disk, automatic
mapping of IPv4 to IPv6 addresses when running in IPv6 mode, somewhat more
efficient memory use, and better compression of the replies. Some of the new
features are described in the second half of this file (look for "new in version
1.1.11"). For the rest of the changes I will have to refer you to the ChangeLog.
For a short history about recent releases have a look at doc/html/index.html.
Since version 1.1.9 I've added some missing pieces to the documentation (the
manual doc/html/doc.html,doc/txt/manual.txt and the man page doc/pdnsd-ctl.8).
Version 1.1.11 finally has a man page doc/pdnsd.8, thanks to a contribution by
Mahesh T. Pai.
The first part of this file describes how to patch, compile, install and run
pdnsd. The second part describes some of the changes I've made to Thomas
Moestl's code.
Unless you're using the pre-patched source archive pdnsd-1.1.11-par.tar.gz you
must first apply my patch file pdnsd-1.1.11-par.diff.gz before compiling and
installing pdnsd according to Thomas Moestl's instructions described in the the
documentation. Use a freshly untarred copy of Thomas Moestl's original version
1.1.7a source, cd into the source directory pdnsd-1.1.7a and apply the command:
gzip -cd <path_to_patch>/pdnsd-1.1.11-par.diff.gz | patch -p2 -N -Z
Note: I have used GNU extensions so there may be some portability issues. I have
supplied alternatives for some of the less portable functions. There should be no
problem with most Linux distributions.
That's it! You should now be able to compile, install and run pdnsd. See the
documentation in doc/html/doc.html or doc/txt/manual.txt for more detailed
instructions.
Some people may want change the compiler optimization flag. I use the -O2 flag,
but it might be safer to use a lower level of optimization or no optimization at
all. In that case prefix the configure command with the desired compiler flags
like this (assuming you're using a bash shell):
CFLAGS="-O1 -g -Wall" ./configure ...
I have added a new configuration option "--with-thread-lib=<lib>", which you
should use if you experience problems with signal handling under Linux. The
usual symptom is failure by pdnsd to save the cache to disk, and
/var/cache/pdnsd/pdnsd.cache remaining empty. If you experience this kind of
trouble, try reconfiguring with different values for the --with-thread-lib
option. The allowable values are "linuxthreads" (the default), "linuxthreads2"
(or "lt2" for short), and "nptl". I recommend that you first configure and
compile without the --with-thread-lib option, then if you experience trouble try
again with --with-thread-lib=lt2 and recompile.
If your Linux system has an implementation of the Native POSIX Thread Library,
which is the case with Red Hat 9 for instance, you should use
--with-thread-lib=nptl .
Ideally, I would like to write a configure script which automatically detects
which kind of thread library is being used on a Linux system, but I don't have a
clue yet how to do this. If you can help me with this please write to me at the
email address listed at the end of this file.
The rest of this file describes some of the modifications I've made, but you
don't have to read it if you simply want to run pdnsd as you're used to.
- The main new feature I've added enables you to change the server addresses
that pdnsd uses at run-time using pdnsd-ctl. I've done this because the ISPs I
use do not specify fixed DNS server addresses, but expect their clients to use
dynamic DNS configuration (DHCP in the case of the cable connection, RFC1877
in case of isdn). I've extended the options that can be given with the
"server" command to pdnsd-ctl, to allow IP addresses to be specified as an
additional argument after "up|down|retest". This allows me to put something
like this in my ifup-local script:
pdnsd-ctl server isp-label up "$DNS1 $DNS2"
For more details how to use pdnsd-ctl read the updated documentation in
the doc/html directory. There is also a manpage for pdnsd-ctl.
This was quite tricky to implement because there might be pending queries
while the addresses are being changed. It certainly was an interesting
exercise in writing multi-threaded code for me.
- I've implemented a feature which allowed me to specify multiple IP addresses
per server section in the configuration file. This allowed for a much more
compact configuration file (3 server sections instead of 7 in my case),
because most configuration options are identical for servers belonging to the
same ISP. It also made the output of "pdnsd-ctl status" more compact. And it
was necessary to enable a satisfactory implementation of the previous feature.
Example of the new syntax:
ip = 123.456.789.001, 123.456.789.002, 123.456.789.003;
At the suggestion of Greg Norris server sections no longer have to specify IP
addresses. A server section without IP addresses will remain inactive until it
is assigned one more addresses at run-time with pdnsd-ctl.
- I've changed the implementation of dynamic arrays to make it slightly more
efficient, and improve type safety. I also got rid of several arrays of fixed
size in favor of dynamically allocated arrays. In particular, I got rid of
all occurrences of MAXPATH. I also made several static variables "automatic".
- The output of the "status" command of pdnsd-ctl now gives more meaningful
constant names "ping|none|if|exec" instead of numbers for the "uptest" option.
I've also added some information that was previously missing.
- I've fixed I a problem that caused pdnsd to use up a lot of CPU time and slow
down my system considerably when it received a query that took a long time to
resolve. It turned out that pdnsd can get into a "busy spin" when one of the
DNS servers pdnsd is querying refuses the connection. Apart from fixing this
bug, to speed things up additionally, I thought it would be a good idea to
mark a server down (without retesting it) after detecting errno==ECONNREFUSED.
This gives me very satisfactory performance, with the problematic server being
tried only once during every testing interval.
New in version 1.1.11: An additional busy spin condition, triggered when a
remote server answers with "Not Implemented", has been discovered and fixed.
In case there are remaining bugs in the multiplexing code, I've added a test
that checks if the number of events reported by poll/select matches the number
of events handled by pdnsd. If not, pdnsd will log an error message and give
up. Although the bugs still need to be reported and fixed, at least this
should prevent pdnsd from wasting CPU cycles.
- Due to a bug in Thomas' code, pdnsd tries, but fails, to remove the control
socket "pdnsd.status" before exiting. This has also been fixed. In version
1.1.8b1-par6 I have cleaned this up some more so that pdnsd will handle
situations where it can't open or bind the control socket more gracefully.
- I've rewritten some of the code that saves the contents of the cache to the
file "pdnsd.cache" just before pdnsd exits. This is because I noticed in my
logfiles that pdnsd occasionally had problems reading this file back at
startup. I eliminated the use of fseek() in Thomas' code. I could not find
anything that was demonstrably incorrect about his use of fseek(), but it
seemed better to me to do without it and write the file in a strictly
sequential order. Anyway, it turned out my hunch paid off: no more error
messages about "pdnsd.cache" in my logfile.
New in version 1.1.11: I've added some new code for sorting the queue used for
purging stale cache entries. This should allow pdnsd to start up faster when
reading large cache files from disk.
- I've extended the configuration options for policies of inclusion/exclusion
lists in server sections. The new policies options are "simple_only" and
"fqdn_only". Setting policy=simple_only will cause the server to used only for
simple hostnames if no other rule matches. On the other hand, setting
policy=fqdn_only will cause the server to be used only for fully qualified
domain names (i.e. the name has at least one dot in-between). I find these
options useful for controlling which name servers (if any) will be used by
pdnsd for simple host names.
- I've added a new "delegation_only" option that can be used to undo the
unwanted effects of DNS "wildcards". It works roughly as the feature by the
same name in BIND. It is turned off by default. To block Verisign's
Sitefinder, add the following line to the global section of the configuration
file:
delegation_only= com, net;
If you find that this feature blocks some legitimate domain names, you will
probably need to add the address of a nameserver that provides good authority
information. More information can be found at
http://www.phys.uu.nl/~rombouts/pdnsd/delegationonly.html
- It is no longer mandatory that domain names in the configuration file end in a
dot.
- The parser for configuration files has been rewritten purely in C, so (f)lex
and yacc/bison are no longer needed to build pdnsd.
It is no longer necessary to place strings between quotes in the configuration
file, unless a string contains a special character such as whitespace, a token
that normally starts a comment, or one of the characters ",;{}". Note that
these special characters are illegal in domain names anyway.
- New in version 1.1.11: Negating whole domains with a neg section in the
config file will result in all the subdomains being negated as well.
For example, adding the lines
neg {name=doubleclick.com; types=domain;}
neg {name=doubleclick.net; types=domain;}
will also negate ad.doubleclick.com, ad.fr.doubleclick.net, etc.
- New in version 1.1.11: When running in IPv6 mode, pdnsd will now automatically
map any IPv4 addresses it reads in the config file to IPv6 addresses.
When pdnsd has been compiled with IPv6 support and runs in IPv4 mode, it will
skip IPv6 addresses with a warning message. This may result in certain server
sections becoming inactive, though.
The -4 and -6 options should now work as advertised.
I've added two new command-line options, "-a" and "-i <prefix>".
With the -a flag pdnsd will try to detect automatically if IPv6 support is
available on a system, and fall back to IPv4 if not. The -a flag can be used
instead of -4 or -6.
The -i option can be used to specify a prefix for mapping IPv4 to IPv6
address. The default is ::ffff.0.0.0.0. There is also a corresponding
ipv4_6_prefix= option for the config file.
- New in version 1.1.11: I've slightly changed the way pdnsd does parallel
queries. Active queries or not canceled until we have received a useful
response from a remote name server, or all the queries have failed or timed
out. Thus the par_queries parameter is no longer the maximum number of
parallel queries, but rather the increment with which the number of parallel
queries is increased when the previous set has timed out. In the worst case
there will be pending queries to all the servers in the list of available
servers simultaneously. We may be wasting more system resources this way, but
the advantage is that we have a greater chance of catching a reply. After all,
if we wait longer anyway, why not for more servers.
I've also introduced a global timeout parameter. This is the minimum period of
time pdnsd will wait after sending the first query to a remote server before
giving up without having received a reply. The timeout options in the
configuration file are now only minimum timeout intervals. Setting the global
timeout option makes it possible to specify quite short timeout intervals in
the server sections. This will have the effect that pdnsd will start querying
additional servers fairly quickly if the first servers are slow to respond
(but will still continue to listen for responses from the first ones). This
may allow pdnsd to get an answer more quickly in certain situations.
After receiving a reply from a remote server the server is marked up and its
time stamp is updated. This will have the effect that pdnsd doesn't bother
testing this server for availability for a period of time, and thus the
overhead caused by testing is reduced. After server timeouts, uptests are
performed by the separate server status thread, not by threads that have to
answer queries. Unresponsive servers with uptest=ping will not be marked down
immediately any more, but only after the ping test has definitely failed.
I've also included a number of bug-fixes contained in a patch file supplied to
me by Thomas Moestl. In addition to the things I had already fixed, the
following issues are addressed: some memory leaks, dropping of root privileges
before calling uptest scripts in case pdnsd was started setuid root (which is a
bad idea anyway), passing on open fd's to uptests, integer overruns in the
status reporting code, fixing string passing from the lexer, more consistent
treatment of underscores in domain names.
In addition to the things I've listed above, I've made various little changes to
fix minor bugs, improve efficiency or elegance, or simply to suit my my own
coding style. These changes are too numerous to list here, but some of them are
listed in the ChangeLog. Of course if you are really interested in the
nitty-gritty you can always compare the source of my version with Thomas'
original code.
If you have any questions about the modifications I've made, you can send these
to <p.a.rombouts@home.nl>. Questions about the original pdnsd version should
be sent to <tmoestl@gmx.net> or <t.moestl@tu-bs.de>.

View File

@ -0,0 +1,66 @@
This is a (hopefully complete) list of people I have to thank for helping me
develop and improve pdnsd:
David G. Andersen
Andrew M. Bishop
Daniel Black
Carsten Block
Stephan Boettcher
P.J. Bostley
Rodney Brown
Kevin A. Burton
Juliusz Chroboczek
Joachim Dorner
Frank Elsner
Christian Engstler
Stefan Erhardt
Bjoern Fischer
Stefan Förster
Bert Frederiks
Mike Hammer
Jonathan Hudson
Torben Janssen
Byrial Jensen
Olaf Kirch
Nikola Kotur
Kiyo Kelvin Lee
Bernd Leibing
Patrick Loschmidt
James MacLean
Sourav K. Mandal
Fraser McCrossan
Markus Mohr
Michael Müller
Gustavo Niemeyer
Alexandre Nunes
Wolfgang Ocker
Mahesh T. Pai
Bernhard Pelz
Soenke J. Peters
Erich Reitz
Paul A. Rombouts
Brian Schroeder
Roman Shterenzon
Daniel Smolik
Milan P. Stanic
Michael Steiner
Norbert Steinl
Andreas Steinmetz
Marko Stolle
Markus Storm
Michael Ströder
Thomas Stromberg
Alan Swanson
Lyonel Vincent
Eelco Vriezekolk
Paul Wagland
Sverker Wiberg
Michael Wiedmann
Ron Yorston
Nikita V. Youshchenko
Jan-Marek Glogowski
Thomas Cort
Pierre Habouzit
Dirk Armbrust
Georg Schwarz
Ashish Shukla

View File

@ -0,0 +1,20 @@
- Implement a reference counter to ensure that newly entered records are not
purged immediately (really needed?)
- Perhaps do a two-step form of recursive query: first query those servers we
have got cached, then (if unsuccessful) look the others up and query again.
The impact of this optimisation may not be very big, because all sane servers
give A records for NS records if possible.
- Test for compatibility on other Unix-like Systems other than the BSDs and
Linux; rewrite the functions in netdev.c and icmp.c for those OSs if
necessary. Also try to get compatibility for other compilers than gcc.
- Write an install rule for the Slackware start-up script.
- Update the FAQ.
- Implement DNSSEC support. Since version 1.2.9, pdnsd is able to cache the RR
types necessary for DNSSEC, but the resolver is not yet security aware.
- Implement a lookup table (hash table) for queries in progress. This would
enable a thread that is resolving a query that is already being handled by
another thread to wait for that other thread to finish and copy its result
rather than independently query remote servers. It is very common for
resolvers to resend UDP queries if they don't get a reply within a timeout
period and if the answer is not yet cached, this will result in multiple
threads duplicating each others work in the current implementation.

View File

@ -0,0 +1,191 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
/* ONLY EDIT acconfig.h, NEVER config.h or config.h.in!
* config.h MAY BE OVERWRITTEN BY make, config.h.in by autoheader! */
/* Define your Target here. Currently defined are TARGET_LINUX (any
* architecture), TARGET_BSD (experimental; tested on FreeBSD, hopefully
* works for other BSD variants) and TARGET_CYGWIN. */
#define TARGET TARGET_LINUX
/* change the #undef to #define if you do not want to compile with special
* ISDN support for Linux. Note that the ISDN support will not compile ok on
* unpatched kernerls earlier than 2.2.12 (if you did apply newer isdn patches,
* it may work fine). This is not on by default because it will cause compile
* problems on some systems */
#undef ISDN_SUPPORT
/* The following regulates the IP Protocol support. Supported types are IPv4
* and IPv6 (aka IPng). You may enable either or both of these protocols.
* Enabling in this context means that support for the respective protocol
* will be in the binary. When running the binary, one of the protocols may
* be activated via command line switches. Note that activating both IPv4 and
* IPv6 is pointless (and will not work because two UDP and two TCP threads
* will be started that concur for ports). Because of that, it is not allowed.
* When pdnsd runs with IPv6 activated it should be able to service queries
* from IPv6 as well as from IPv4 hosts, provided that you host is configured
* properly.
* For each of the protocols there are two options: ENABLE_IPV4 and ENABLE_IPV6
* control whether support for the respective protocol is available in the
* binary. DEFAULT_IPV4 selects which protocol is enabled on pdnsd
* startup by default. 1 means IPv4, while 0 means IPv6. If support for
* a protocol was included in the executable, you can specify command line
* parameters to activate or deactivate that protocol (the options are -4 and
* -6), but it makes more sense to use the run_ipv4=on/off option in the
* configuration file.
* Make your choice. Note that IPv6 support is experimental in pdnsd.
* In normal operation, you will currently only need IPv4. */
#undef ENABLE_IPV4
#define DEFAULT_IPV4 1
#undef ENABLE_IPV6
/* In all pdnsd versions before 1.0.6, DNS queries were always done over
* TCP. Now, you have the choice. You can control that behaviour using
* the -m command line switch, and you can give a preset here. There
* are 3 different modes:
* UDP_ONLY: This is undoubtedly the fastest query method, because
* no TCP negotiation needs to be done.
* TCP_ONLY: This is slower than uo, but generally more secure
* against DNS spoofing. Note that some name servers on the
* internet do not support TCP queries, notably dnscache.
* TCP_UDP: TCP, then UDP. If the TCP query fails with a "connection refused"-
* error or times out, the query is retried using UDP.
* UDP_TCP: UDP, then TCP. If the UDP reply is truncated (i.e. the tc flag is set),
* the query is retried using TCP. */
#define M_PRESET UDP_ONLY
/* In addition to choosing the presets, you may also completely disable
* one of the protocols (TCP for preset UDP_ONLY and UDP for preset TCP_ONLY).
* This saves some executable space. */
#undef NO_UDP_QUERIES
#undef NO_TCP_QUERIES
/* With the following option, you can disable the TCP server functionality
* of pdnsd. Nearly no program does TCP queries, so you probably can do
* this safely and save some executable space and one thread.
* You also can turn off the TCP server at runtime with the --notcp option. */
#undef NO_TCP_SERVER
/* By undefining the following, you can disable the UDP source address
* discovery code. This is not recommended, but you may need it when
* running into compilation problems. */
#undef SRC_ADDR_DISC
/* NO_POLL specifies not to use poll(2), but select(2) instead. If you are
* unsure about what this means, just leave this as it is.*/
#undef NO_POLL
/* Define this for "hard" RFC 2181 compliance: this RFC states that
* implementations should discard answers whose RR sets have multiple
* different time stamps. While correct answers are generated, incorrect
* ones are normally tolerated and corrected. Full RFC compliance is
* however only achieved by deactivating this behaviour and thus being
* intolerant. */
#undef RFC2181_ME_HARDER
/* Define this to the device you want to use for getting random numbers.
* Leave this undefined if you wand to use the standard C library random
* function, which basically should be sufficient.
* Linux and FreeBSD have two random number devices: /dev/random and
* /dev/urandom. /dev/urandom might be less secure in some cases, but
* should still be more than sufficient. The use of /dev/random is
* discouraged, as reading from this device blocks when new random bits
* need to be gathered. */
#undef RANDOM_DEVICE
#undef R_DEFAULT
#undef R_RANDOM
#undef R_ARC4RANDOM
/*#define RANDOM_DEVICE "/dev/urandom"*/
/* Designate which database manager to use for cacheing.
* default: native; others: gdbm */
#define CACHE_DBM DBM_NATIVE
#define CACHEDIR "/var/cache/pdnsd"
#define TEMPDIR "/tmp";
/* This is for various debugging facilities that produce debug output and
* double-check some values. You can enable debug messages with the -g option.
* Normally, you can switch this off safely by setting the number after DEBUG
* to 0. This will increase speed (although only marginally), save space
* in the executable (only about 12kB) and some stack space per thread
* (which may be significant if you have many threads running simultaneously).
* However, it may be an aid when debugging config files.
* The only defined debug levels by now are in the range 0 - 9.
* Define this to 9 if you want hex dumps of all the queries and replies pdnsd
* receives (you must also call pdnsd with -v9 to actually see the hex dumps).
* When in doubt, leave it defined to 1. */
#define DEBUG 1
/* This defines the default verbosity of informational messages you will get.
This has nothing to to with the debug option (-g), but may be set with -v
option. 0 is for normal operation, up to 3 for debugging.
Unlike the debug messages, these messages will also be written to the syslog.*/
#define VERBOSITY 0
/* Redefine this if you want another hash size.
* The number of hash buckets is computed as power of two (1<<HASH_SZ);
* so e.g. HASH_SZ set to 10 yields 1024 hash rows.
* HASH_SZ may not be bigger than 32 (if you set it even close to that value,
* you are nuts.) */
#define HASH_SZ 10
/* Set this to debug the hash tables. Turn this off normally, or you will get
* flooded with diagnostic messages */
#undef DEBUG_HASH
/* Define if you have working C99 Variadic macro support */
#undef CPP_C99_VARIADIC_MACROS
/* Define as int if socklen_t typedef is missing */
#undef socklen_t
/* Lock the UDP socket before using it? */
#undef SOCKET_LOCKING
/* Default TCP timeout when receiving queries */
#define TCP_TIMEOUT 30
/* Allow subsequent TCP queries on one connection? */
#undef TCP_SUBSEQ
/* Default value for parallel query number */
#define PAR_QUERIES 2
/* Maximum number of IP addresses used per nameserver obtained from NS records. */
#define MAXNAMESERVIPS 3
/* These are the possible targets. Normally no need to touch these
* definitions. */
#define TARGET_LINUX 0
#define TARGET_BSD 1
#define TARGET_CYGWIN 2
/* Assume the Native POSIX Thread Library instead of LinuxThreads ? */
#undef THREADLIB_NPTL
/* If we are using LinuxThreads, implement the fix needed for newer glibcs ? */
#undef THREADLIB_LINUXTHREADS2
/* The following is needed for using LinuxThreads. Better don't touch. */
#define _REENTRANT 1
#define _THREAD_SAFE 1
/* It appears the newer versions of gcc won't convert a pointer to char into
a pointer to unsigned char and vice versa without complaining.
By using casts these warning messages can be suppressed, but at the cost
of losing some type safety.
Define charp and ucharp to be empty if you are a developer and find type
safety more important.
Leave the definitions unchanged to avoid distracting warning messages. */
#define charp (char *)
#define ucharp (unsigned char *)
/* pdnsd version. DO NOT TOUCH THIS! It is replaced automatically by the
* contents of ./version */
#define VERSION "@VERSION@"
#endif

1021
app/src/main/jni/pdnsd/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More