Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AS lite db availability #3

Open
GyulyVGC opened this issue Dec 6, 2022 · 2 comments
Open

AS lite db availability #3

GyulyVGC opened this issue Dec 6, 2022 · 2 comments

Comments

@GyulyVGC
Copy link

GyulyVGC commented Dec 6, 2022

It would be nice to have a macro that works as the already present macro to load countries, but for querying autonomous system db.

It could be of interest to add the same support in terms of automatic fetching and compression of the latest db version as well, as already done for countries.

@finnbear
Copy link
Owner

finnbear commented Dec 7, 2022

It would be nice to have a macro that works as the already present macro to load countries, but for querying autonomous system db.

It's currently possible to create a DbIpDatabase<Asn> where struct Asn { number: usize, name: String } and impl IpData for Asn { ... }.

I agree that a dedicated macro and Asn in this crate would make it easier, but I think I'd rather create a more general macro. Maybe something like:

use db_ip::{include_database, Asn, DbIpDatabase};
let db: DbIpDatabase<Asn> = include_database!("asn_data.csv", Asn);

If it was a procedural macro, it emit Rust code as opposed to requiring compression/serialization of any kind (or it could just compress/serialize if the Rust code bloated the binary too much).

Anyway, while I'm currently a bit busy, I'll see if I can find some time to add this soon :)

@GyulyVGC
Copy link
Author

GyulyVGC commented Dec 7, 2022

No worries, thanks for your support mate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants