Giter VIP home page Giter VIP logo

rsdns's People

Contributors

r-bk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nneesshh

rsdns's Issues

'rustfmt' is not installed for the toolchain

Hello,

I'm currently trying to use this crate but it cannot be compiled due to the build script requiring rustfmt, however this tool is not installed on the official Rust build images (https://hub.docker.com/_/rust), nor it is on many build environments.

I don't know if it can be called a bug or a misconception, as build scripts should not rely on such tools being present (nor even really care about formatting of the code).

In my case it's out of question to change anything in the build environment "just" to have some DNS resolution features.

I can only recommend you to remove this requirement for future users, otherwise this lib seems really to be a good tool, even if I'm a bit surprised by the way it is implemented.

Impossible to use library.

Hello there,

I am trying to use the library in a project. I was trying to use default example showed in the doc.rs of this crate.

I got a curious error :

error[E0433]: failed to resolve: could not find `resolvers` in `rsdns`
 --> src/main.rs:6:12
  |
6 | use rsdns::resolvers::{std::Resolver, ResolverConfig};
  |            ^^^^^^^^^ could not find `resolvers` in `rsdns`

error[E0432]: unresolved import `rsdns::resolvers`
 --> src/main.rs:6:12
  |
6 | use rsdns::resolvers::{std::Resolver, ResolverConfig};
  |            ^^^^^^^^^ could not find `resolvers` in `rsdns`

error[E0433]: failed to resolve: use of undeclared type `Resolver`
  --> src/main.rs:68:24
   |
68 |     let mut resolver = Resolver::new(ResolverConfig::with_nameserver(nameserver))?;
   |                        ^^^^^^^^ use of undeclared type `Resolver`

Here is the code :

use serde::Deserialize;
use serde::Serialize;
use std::collections::HashMap;
// DNS client lib
use rsdns::{constants::Class, records::data::A};
use rsdns::clients::{std::net::Client, ClientConfig};
use std::net::SocketAddr;

...

fn resolve_query(
    query: &str,
    query_type: &str,
    servers: Vec<String>,
) -> Result<Vec<A>, Box<dyn std::error::Error>> {
    let nameserver = SocketAddr::from_str("192.168.33.205:53")?;
    let mut client = Client::new(ClientConfig::with_nameserver(nameserver))?;
    let rrset = client.query_rrset::<A>(query, Class::In)?;
    Ok(rrset.rdata)
}

I checked source code and saw that your crate are well exported with rsdns::clients.

Any idea why it don't works on my machine ? =)

how about the roadmap?

I like rsdns because it is simple, and I noticed that "Zero memory allocation for all essential data-types records" is a next feature.
Is it nesseray for a simple project? or "rsdns" has a bottle neck for it?

Unsound usages of unsafe implementation from `buf` to `$t`

Hi, I am scanning the rsdns in the latest version with my own static analyzer tool.

Unsafe conversion found at: src/bytes/macros.rs#L5

macro_rules! r_be {
    ($self:ident, $t:ty) => {{
        if $self.len() >= std::mem::size_of::<$t>() {
            let buf = unsafe { $self.buf.get_unchecked($self.pos..) };
            let ptr = buf.as_ptr() as *const $t;
            let v = unsafe { ptr.read_unaligned() };
            $self.pos += std::mem::size_of::<$t>();
            Ok(v.to_be())
        } else {
            Err($self.bound_error())
        }
    }};
}

This unsound implementation would create a misalignment issues if the type size of buf is smaller than the type size of $t.

This would potentially cause undefined behaviors in Rust. If we further manipulate the problematic converted types, it would potentially lead to different consequences such as access out-of-bound. I am reporting this issue for your attention.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.