Updated version, added dnscache idea
parent
afd124d1fd
commit
4c4a217600
55
LICENSE
55
LICENSE
|
@ -307,6 +307,18 @@
|
|||
Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply
|
||||
See: https://github.com/JetBrains/kotlin/blob/master/license/README.md
|
||||
|
||||
- JNA - Simplified native library access for Java.
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://github.com/twall/jna
|
||||
Copyright 2021
|
||||
Timothy Wall
|
||||
|
||||
- JNA-Platform - Mappings for a number of commonly used platform functions
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://github.com/twall/jna
|
||||
Copyright 2021
|
||||
Timothy Wall
|
||||
|
||||
- Java Uuid Generator - A set of Java classes for working with UUIDs
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://github.com/cowtowncoder/java-uuid-generator
|
||||
|
@ -358,21 +370,6 @@
|
|||
Lasse Collin
|
||||
Igor Pavlov
|
||||
|
||||
- Updates - Software Update Management
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://git.dorkbox.com/dorkbox/Updates
|
||||
Copyright 2021
|
||||
Dorkbox LLC
|
||||
|
||||
Extra license information
|
||||
- Kotlin -
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://github.com/JetBrains/kotlin
|
||||
Copyright 2020
|
||||
JetBrains s.r.o. and Kotlin Programming Language contributors
|
||||
Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply
|
||||
See: https://github.com/JetBrains/kotlin/blob/master/license/README.md
|
||||
|
||||
- Executor - Shell, JVM, and SSH command execution on Linux, MacOS, or Windows for Java 8+
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://git.dorkbox.com/dorkbox/Executor
|
||||
|
@ -467,30 +464,20 @@
|
|||
Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply
|
||||
See: https://github.com/JetBrains/kotlin/blob/master/license/README.md
|
||||
|
||||
- SwtJavaFx - Swt and JavaFx Utilities
|
||||
- Updates - Software Update Management
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://git.dorkbox.com/dorkbox/SwtJavaFx
|
||||
https://git.dorkbox.com/dorkbox/Updates
|
||||
Copyright 2021
|
||||
Dorkbox LLC
|
||||
|
||||
Extra license information
|
||||
- Eclipse Platform - Frameworks and common services to support the use of Eclipse and it's tools (SWT)
|
||||
[Eclipse Public License (EPL)]
|
||||
https://projects.eclipse.org/projects/eclipse.platform
|
||||
Copyright 2021
|
||||
The Eclipse Foundation, Inc.
|
||||
|
||||
- OpenJFX - OpenJFX client application platform for desktop, mobile and embedded systems
|
||||
[GNU General Public License, version 2, with the Classpath Exception]
|
||||
https://github.com/openjdk/jfx
|
||||
Copyright 2021
|
||||
Oracle and/or its affiliates
|
||||
|
||||
- SLF4J - Simple facade or abstraction for various logging frameworks
|
||||
[MIT License]
|
||||
http://www.slf4j.org
|
||||
Copyright 2021
|
||||
QOS.ch
|
||||
- Kotlin -
|
||||
[The Apache Software License, Version 2.0]
|
||||
https://github.com/JetBrains/kotlin
|
||||
Copyright 2020
|
||||
JetBrains s.r.o. and Kotlin Programming Language contributors
|
||||
Kotlin Compiler, Test Data+Libraries, and Tools repository contain third-party code, to which different licenses may apply
|
||||
See: https://github.com/JetBrains/kotlin/blob/master/license/README.md
|
||||
|
||||
- Updates - Software Update Management
|
||||
[The Apache Software License, Version 2.0]
|
||||
|
|
25
README.md
25
README.md
|
@ -1,12 +1,10 @@
|
|||
NetworkDNS
|
||||
=======
|
||||
|
||||
###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/NetworkDNS) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/NetworkDNS) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/NetworkDNS) [![Bitbucket](https://badge.dorkbox.com/bitbucket.svg "Bitbucket")](https://bitbucket.org/dorkbox/NetworkDNS)
|
||||
###### [![Dorkbox](https://badge.dorkbox.com/dorkbox.svg "Dorkbox")](https://git.dorkbox.com/dorkbox/NetworkDNS) [![Github](https://badge.dorkbox.com/github.svg "Github")](https://github.com/dorkbox/NetworkDNS) [![Gitlab](https://badge.dorkbox.com/gitlab.svg "Gitlab")](https://gitlab.com/dorkbox/NetworkDNS)
|
||||
|
||||
|
||||
The NetworkDNS project is a high-performance and event-driven/reactive DNS network stack for Java 8+
|
||||
|
||||
- Note: There is a maximum packet size for UDP, 508 bytes *to guarantee it's unfragmented*
|
||||
The NetworkDNS project is a high-performance and event-driven/reactive DNS stack for Java 8+
|
||||
|
||||
- This is for cross-platform use, specifically - linux 32/64, mac 64, and windows 32/64. Java 8+
|
||||
|
||||
|
@ -19,30 +17,21 @@ Maven Info
|
|||
<dependency>
|
||||
<groupId>com.dorkbox</groupId>
|
||||
<artifactId>NetworkDNS</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
```
|
||||
|
||||
Gradle Info
|
||||
---------
|
||||
````
|
||||
```
|
||||
dependencies {
|
||||
...
|
||||
compile 'com.dorkbox:NetworkDNS:1.0'
|
||||
implementation("com.dorkbox:NetworkDNS:1.3")
|
||||
}
|
||||
````
|
||||
|
||||
Or if you don't want to use Maven, you can access the files directly here:
|
||||
https://repo1.maven.org/maven2/com/dorkbox/NetworkDNS/
|
||||
|
||||
https://repo1.maven.org/maven2/com/dorkbox/Network/
|
||||
https://repo1.maven.org/maven2/org/slf4j/slf4j-api/
|
||||
https://repo1.maven.org/maven2/io/netty/netty-all/ (latest 4.1)
|
||||
|
||||
https://repo1.maven.org/maven2/com/esotericsoftware/kryo/
|
||||
```
|
||||
|
||||
License
|
||||
---------
|
||||
This project is © 2018 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.
|
||||
This project is © 2021 dorkbox llc, and is distributed under the terms of the Apache v2.0 License. See file "LICENSE" for further references.
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ object Extras {
|
|||
// set for the project
|
||||
const val description = "High-performance and event-driven/reactive DNS stack for Java 8+"
|
||||
const val group = "com.dorkbox"
|
||||
const val version = "1.2"
|
||||
const val version = "1.3"
|
||||
|
||||
// set as project.ext
|
||||
const val name = "NetworkDNS"
|
||||
|
@ -56,7 +56,7 @@ object Extras {
|
|||
GradleUtils.load("$projectDir/../../gradle.properties", Extras)
|
||||
GradleUtils.defaults()
|
||||
GradleUtils.compileConfiguration(JavaVersion.VERSION_1_8)
|
||||
//GradleUtils.jpms(JavaVersion.VERSION_1_9)
|
||||
GradleUtils.jpms(JavaVersion.VERSION_1_9)
|
||||
|
||||
|
||||
licensing {
|
||||
|
@ -89,8 +89,8 @@ tasks.jar.get().apply {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation("com.dorkbox:NetworkUtils:2.5")
|
||||
implementation("com.dorkbox:Utilities:1.10")
|
||||
implementation("com.dorkbox:NetworkUtils:2.8")
|
||||
implementation("com.dorkbox:Utilities:1.11")
|
||||
implementation("com.dorkbox:Updates:1.1")
|
||||
|
||||
implementation("io.netty:netty-all:4.1.63.Final")
|
||||
|
|
|
@ -0,0 +1,153 @@
|
|||
//package dorkbox.network
|
||||
//
|
||||
//import dorkbox.netUtil.IPv4
|
||||
//import dorkbox.util.collections.IntMap
|
||||
//
|
||||
///*
|
||||
// * This is a "most complex" example of how DNS entries can be used.
|
||||
// * NOTE: D can have B (domain) as a parent AND ALSO 1 (ip) as a parent.
|
||||
// *
|
||||
// * ROOT: 1 2 3
|
||||
// * /|\ /| |
|
||||
// * / | X | |
|
||||
// * | |/ \| |
|
||||
// * CHILD: | A B C
|
||||
// * | /|\
|
||||
// * \ / | \
|
||||
// * \ / | \
|
||||
// * CHILD: D E F
|
||||
// */
|
||||
//internal class DnsCache {
|
||||
// internal open inner class Entry {
|
||||
// var children: MutableMap<String?, DomainEntry?>? = HashMap()
|
||||
// }
|
||||
//
|
||||
// internal inner class IpEntry : Entry() {
|
||||
// var ip = 0
|
||||
// val ipAsString: String
|
||||
// get() = IPv4.toString(ip)
|
||||
// }
|
||||
//
|
||||
// internal inner class DomainEntry : Entry() {
|
||||
// var domain: String? = null
|
||||
//
|
||||
// // we can have BOTH parent IPs and parent DOMAINS
|
||||
// var parentIPs: IntMap<IpEntry> = IntMap()
|
||||
// var parentDomains: MutableMap<String, DomainEntry> = HashMap()
|
||||
// }
|
||||
//
|
||||
// // this map contains ALL of the DOMAIN'S possible (then, each domain has 1+ parents or 1+ children
|
||||
// private val domains: MutableMap<String, DomainEntry> = HashMap()
|
||||
//
|
||||
// // this map contains ALL of the IP'S possible (then, each IP will have 1+ children)
|
||||
// private val ips: IntMap<IpEntry> = IntMap()
|
||||
//
|
||||
//
|
||||
// private fun getDomain(domain: String): DomainEntry? {
|
||||
// var domainEntry = domains[domain]
|
||||
// if (domainEntry == null) {
|
||||
// domainEntry = DomainEntry()
|
||||
// domainEntry.domain = domain
|
||||
// domains[domain] = domainEntry
|
||||
// }
|
||||
// return domainEntry
|
||||
// }
|
||||
//
|
||||
// private fun linkParentAndChild(parentDomain: String, childEntry: DomainEntry) {
|
||||
// var parentEntry = domains[parentDomain]
|
||||
// if (parentEntry == null) {
|
||||
// parentEntry = DomainEntry()
|
||||
// parentEntry.domain = parentDomain
|
||||
// domains[parentDomain] = parentEntry
|
||||
// }
|
||||
//
|
||||
// // link the two together
|
||||
// childEntry.parentDomains[parentDomain] = parentEntry
|
||||
// parentEntry.children!![childEntry.domain] = childEntry
|
||||
// }
|
||||
//
|
||||
// private fun linkParentAndChild(parentIp: Int, childEntry: DomainEntry?) {
|
||||
// var parentEntry: IpEntry = ips.get(parentIp)
|
||||
// if (parentEntry == null) {
|
||||
// parentEntry = IpEntry()
|
||||
// parentEntry.ip = parentIp
|
||||
// ips.put(parentIp, parentEntry)
|
||||
// }
|
||||
//
|
||||
// // link the two together
|
||||
// childEntry!!.parentIPs.put(parentIp, parentEntry)
|
||||
// parentEntry.children!![childEntry.domain] = childEntry
|
||||
// }
|
||||
//
|
||||
// // also, one question can have multiple answers, and we don't want to overwrite them if the same IP goes to multiple questions.
|
||||
// //
|
||||
// // As "criss-crossy" and weird as this CAN get, we reset this at midnight, JUST because this will get crazy. As a result, we do not do
|
||||
// // any maintenance on the map. It is not TOO likely that IPs will change in 1 day. It is definitely possible, and this solves the
|
||||
// // problem by just "hanging onto" the old IPs for the rest of the day. Since we rewrite the TTL on DNS packets to be 60 seconds, it
|
||||
// // should also prevent stale lookups
|
||||
//// fun processDNS(dns: dnsEntry) {
|
||||
//// // here we have to correlate CNAME with original question, because the QUESTION is what we know and care about
|
||||
//// val question: String = dns.question
|
||||
//// if (question != null) {
|
||||
//// val childEntry = getDomain(question)
|
||||
//// for (cName in dns.cname) {
|
||||
//// // the cName will be the parent to the question
|
||||
//// linkParentAndChild(cName, childEntry)
|
||||
//// }
|
||||
//// for (aRecord in dns.a) {
|
||||
//// val asInt = toInt(aRecord!!)
|
||||
////
|
||||
//// // can ONLY be a parent to our question
|
||||
//// linkParentAndChild(asInt, childEntry)
|
||||
//// }
|
||||
//// }
|
||||
//// else {
|
||||
//// // this makes GC graph traversal faster
|
||||
//// for (domainEntry in domains!!.values) {
|
||||
//// domainEntry!!.parentIPs.clear()
|
||||
//// domainEntry.parentDomains!!.clear()
|
||||
//// domainEntry.children!!.clear()
|
||||
//// }
|
||||
//// domains.clear()
|
||||
////
|
||||
//// // this makes GC graph traversal faster
|
||||
//// for (o in ips.values()) {
|
||||
//// val ipEntry = o as IpEntry
|
||||
//// ipEntry.children!!.clear()
|
||||
//// }
|
||||
//// ips.clear()
|
||||
////
|
||||
//// // encourage GC, since a heck of a lot of entries just got nuked.
|
||||
//// System.gc()
|
||||
//// }
|
||||
//// }
|
||||
//
|
||||
// /**
|
||||
// * quite often, the domain for traffic is **really** the CNAME value for the original DNS question
|
||||
// *
|
||||
// * @param dnsDomain the domain to check (to see if it maps to an original DNS question)
|
||||
// *
|
||||
// * @return either the original question DNS value, or dnsDomain.
|
||||
// */
|
||||
// operator fun get(dnsDomain: String?): String? {
|
||||
//// HashSet<String> dns = reverseMap.get(dnsDomain);
|
||||
//// if (dns == null) {
|
||||
//// return dnsDomain;
|
||||
//// }
|
||||
//// else {
|
||||
//// // WORST CASE SITUATION
|
||||
//// // have to keep on going, because at some point A->B->C
|
||||
//// // 1.2.3.4 -> foo.akamai.net -> cdn.turner.com -> cnn.com
|
||||
//// // 5.6.7.8 -> foo.akamai.net -> cdn.turner.com -> cnn.com
|
||||
//// // 5.6.7.8 -> foo.akamai.net -> espn.com
|
||||
//// // 1.2.7.8 -> foo.akamai.net -> bmw.com
|
||||
//// // 1.2.7.8 -> bar.akamai.net -> ford.com
|
||||
////
|
||||
////// HashSet<String> strings = get(dns);
|
||||
////// if (strings.size() == 1) {
|
||||
////// }
|
||||
//// return dnsDomain;
|
||||
//// }
|
||||
// return ""
|
||||
// }
|
||||
//}
|
|
@ -85,7 +85,7 @@ class DnsClient extends Shutdownable {
|
|||
*/
|
||||
public static
|
||||
String getVersion() {
|
||||
return "1.2";
|
||||
return "1.3";
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -75,7 +75,7 @@ class DnsServer extends Shutdownable {
|
|||
*/
|
||||
public static
|
||||
String getVersion() {
|
||||
return "1.2";
|
||||
return "1.3";
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue