mkroli / dns4s Goto Github PK
View Code? Open in Web Editor NEWScala DNS implementation with Akka and Netty extension
Home Page: https://mkroli.github.io/dns4s
License: Apache License 2.0
Scala DNS implementation with Akka and Netty extension
Home Page: https://mkroli.github.io/dns4s
License: Apache License 2.0
Hi,
The current version 0.9 can only be used with akka-actor_2.10, attempts to use with akka-actor_2.11 throws error. This SO question shows a similar scenario with spray. The error is same in this case too.
Can we release a version for scala 2.11? I would be glad to make a PR but I am not sure what changes would be needed. Any guidance will be great.
I will try to compile this with 2.11 on local and post the results here.
This doesn't work:
addresses = List("1.2.3.4", "2.3.4.5") //This is constructed, I do a lookup in order to get the list
val records: List[ResourceRecordModifier] = addresses.map(str โ {
ARecord(str)
})
Response ~ Questions(host) ~ Answers(records: _*)
It is not allowed to put the _* in there.
I am getting an error while trying to start the DNS
akka.pattern.AskTimeoutException: Ask timed out on
[Actor[akka://DnsServer/user/dns4s#-1020510439]] after [5000 ms]. Message of type
[com.github.mkroli.dns4s.akka.Dns$Bind]. A typical reason for `AskTimeoutException` is that
the recipient actor didn't send a reply.
This is my actor:
class SampleActor extends Actor {
override def receive: Receive = {
case Bound =>
println(s"Bound message received") // <- this get's printed
sender() ! "OK"
case x =>
println(x)
sender() ! "OK"
}
}
object SampleActor {
def start: Future[Any] = {
implicit val system: ActorSystem = ActorSystem("DnsServer")
implicit val timeout: Timeout = Timeout(5 seconds)
val f = IO(Dns) ? Dns.Bind(system.actorOf(Props[SampleActor]), 6345)
f.onComplete {
case Failure(exception) =>
println("DNS service failed to start")
println(exception.getClass.getSimpleName)
println(exception.getMessage)
exception.printStackTrace()
sys.exit(1)
case Success(value) =>
println(s"DNS service: $value")
}
f
}
}
Hello,
I am looking for EDNS0 implementation in order to get client address of dns queries.
Reading current dns4s source code, I am unable to find that implementation or did i miss something?
Could you please provide some guide lines?
Thanks
case class QuestionSection(
qname: String,
qtype: Int,
qclass: Int) extends MessageBufferEncoder {
require(qtype >= 0 && qtype < (1 << 16))
require(qclass >= 0 && qclass < (1 << 16))
qtype of value 257 is CAA
DNS Certification Authority Authorization, constraining acceptable CAs for a host/domain
RFC 6844
Source: https://en.wikipedia.org/wiki/List_of_DNS_record_types
It would be nice to be able to pattern match and handle these queries. Similar to how I can pattern match on TXT queries
case Query(q) ~ Questions(QName(host) ~ TypeTXT() :: Nil)
Context: I am trying to handle CAA queries from let's-encypt
This is the message I received from let's-encrypt
Message(
HeaderSection(61770,false,0,false,false,false,false,0,1,0,0,1),
Vector(
QuestionSection(aPPS.BilAL-FazlANi.COM,257,1)
),
Vector(),
Vector(),
Vector(ResourceRecord(,41,512,32768,OPTResource(List())))
)
When I try to run the example : https://github.com/mkroli/dns4s/blob/master/examples/simple-client/src/main/scala/com/github/mkroli/dns4s/examples/simple/client/DnsClient.scala
, the following message was encountered. Any idea?
Exception in thread "main" java.lang.NoSuchMethodError: akka.pattern.AskableActorRef$.$qmark$default$3$extension(Lakka/actor/ActorRef;Ljava/lang/Object;)Lakka/actor/ActorRef;
at com.github.mkroli.dns4s.examples.simple.client.DnsClient$.delayedEndpoint$com$github$mkroli$dns4s$examples$simple$client$DnsClient$1(DnsClient.scala:36)
at com.github.mkroli.dns4s.examples.simple.client.DnsClient$delayedInit$body.apply(DnsClient.scala:31)
at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.App$$anonfun$main$1.apply(App.scala:76)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76)
at com.github.mkroli.dns4s.examples.simple.client.DnsClient$.main(DnsClient.scala:31)
at com.github.mkroli.dns4s.examples.simple.client.DnsClient.main(DnsClient.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
migrate to Maven Central?
Hi,
As you know dns is a standard but some client miss implement it, so I wonder know if you practiced some tests with bad clients to know how it respond ?
Do you use it in production ? and did experiments some specials defects ?
I would like to use dns4s to implement a custom dns server on medium traffic, so I will really appreciate your answer and let me know if i can do something to help ;)
Emmanuel
Hi @mkroli,
Thanks for this nice project. There is a quick way to support akka typed (or compatibility to run using the akka typed system, maybe using classicSystem)?
java.lang.UnsupportedOperationException: cannot create top-level actor [dns4s] from the outside on ActorSystem with custom user guardian
at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:895)
at com.github.mkroli.dns4s.akka.DnsExtension.<init>(DnsExtension.scala:50)
at com.github.mkroli.dns4s.akka.Dns$.createExtension(DnsExtension.scala:34)
at com.github.mkroli.dns4s.akka.Dns$.createExtension(DnsExtension.scala:33)
at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:1158)
at akka.actor.ExtensionId.apply(Extension.scala:78)
at akka.actor.ExtensionId.apply$(Extension.scala:77)
at com.github.mkroli.dns4s.akka.Dns$.apply(DnsExtension.scala:33)
at akka.io.IO$.apply(IO.scala:26)
at akka.actor.typed.internal.BehaviorImpl$ReceiveMessageBehavior.receive(BehaviorImpl.scala:152)
at akka.actor.typed.Behavior$.interpret(Behavior.scala:274)
at akka.actor.typed.Behavior$.interpretMessage(Behavior.scala:230)
at akka.actor.typed.internal.adapter.ActorAdapter.handleMessage(ActorAdapter.scala:131)
at akka.actor.typed.internal.adapter.ActorAdapter.aroundReceive(ActorAdapter.scala:107)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:579)
at akka.actor.ActorCell.invoke(ActorCell.scala:547)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
at akka.dispatch.Mailbox.run(Mailbox.scala:231)
at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.