Skip to content

Commit

Permalink
Finishing touches
Browse files Browse the repository at this point in the history
  • Loading branch information
michalszmidt committed Dec 4, 2023
1 parent 4a166a4 commit 6b84889
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ task:
GITHUB_TOKEN: ENCRYPTED[c55719815e6b9431df4596dc746645ece3acbd2917ffa29c71a1636d232aa77b7a3684b31667de46f028ca594d7a4b20]
CARGO_TERM_COLOR: always
macos_instance:
image: ghcr.io/cirruslabs/macos-ventura-base:latest
image: ghcr.io/cirruslabs/macos-sonoma-base:latest
prepare_script:
- whoami
- NONINTERACTIVE=1 brew update
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_dragonflybsd_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ env:

jobs:
test:
runs-on: macos-12
runs-on: macos-12
name: Release for DragonflyBSD
steps:
- uses: actions/checkout@v4
- name: Compile
id: release_dfly
uses: vmactions/dragonflybsd-vm@v0
uses: vmactions/dragonflybsd-vm@v1
with:
envs: 'CARGO_TERM_COLOR'
usesh: false
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release_netbsd_amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ env:

jobs:
test:
runs-on: macos-12
runs-on: ubuntu-22.04
name: Release for NetBSD
steps:
- uses: actions/checkout@v4
- name: Build in NetBSD VM
id: compile
uses: vmactions/netbsd-vm@v0
uses: vmactions/netbsd-vm@v1
with:
envs: 'CARGO_TERM_COLOR'
usesh: false
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/release_openbsd_amd64.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Release for OpenBSD amd64

#on:
# push:
# tags:
# - '*'

on:
push:
tags:
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ Packaging progress [issue](https://github.com/michalszmidt/hctl/issues/9)

</td></tr> </table>

<!--
-->


- NSU - Not Set Up Yet, will appear in future

Note that OpenBSD Builds are removed from table as gh Action OpenBSD runner is broken, see [this issue](https://github.com/vmactions/openbsd-vm/issues/12)
- NSU - Not Set Up Yet, may (or not) appear in the future

# Features

Expand All @@ -102,19 +96,22 @@ Note that OpenBSD Builds are removed from table as gh Action OpenBSD runner is b
- [x] Fetch lists directly from network (https)
- [x] YAML config
- [x] Parallel processing
- [x] Progressbar on save
- [x] Rejected lines may be saved with information about source list
- [x] Support for Windows encoded text files (line ending with `\n\r`)
- [x] Output to stdout to be used with unix pipe stream control (partial support)
- [x] Whitelists (enumerated, from external lists file/https)
- [x] Whitelists including subdomains
- [x] Record existance validation from DNS servers (unencrypted and over tls)
- [x] User-defined DNS and DOT Resolvers
- [x] Could use diffrent input types (like dnsmasq, bind) in yaml config
- [ ] Auto scheme recognition
- [ ] YAML has full settings (remote sources, ~whitelist~ , ~args from cli~)
- [ ] Subdomains family recognition, save with subdomain order (like adaway does)
- [ ] Fault-tolerance, better error handling
- [ ] Deep rejected analysis
- [ ] Quiet option
- [ ] Progressbar on save


Jump [here](https://github.com/michalszmidt/hctl/wiki/Manual#supported-formats) to see supported input and output formats

Expand All @@ -123,8 +120,8 @@ Jump [here](https://github.com/michalszmidt/hctl/issues/1) to feature-request is
# [Usage](https://github.com/michalszmidt/hctl/wiki/Usage)


```shell
# hctl -D -h
```bash
# hctl -D --help
Manipulate on domains

Usage: hctl {domain|--domain|-D} [OPTIONS]
Expand All @@ -134,12 +131,13 @@ Options:
-o, --out <out> Path to the out file [stdout/path without quotes]
-z, --optimize <optimize> Optimize for memory or speed, default: memory [memory/speed]
-c, --config <config> Path to config [without qoutes]
-m, --mode <mode> Process single or multiple lists [single/folder/config]
-m, --mode <mode> Process single or multiple lists [single/folder/config/url]
-i, --intro <intro> Whether append intro "Assembled From:..." to out file from config [true/false]
-r, --rejected <rejected> Whether save rejected to ./rejected.txt [true/false]
-f, --format <format> Type of out format [dnsmasq/loopback/empty/linewise/bind/snort/unbound/machosts/hostperm1/junkbuster/littlesnitch/pdnsd]
-t, --validate <validate> (Non-intrusive): Verbose validate your records in single file issuing dns-over-tls query in hardcoded servers [yes/no]
-d, --dns <dns> Validate your processed records issuing dns query in predefined servers, config mode allows custom ones [yes/no]
-a, --pattern <pattern> Input format of list [hosts/dnsmasq]
-h, --help Print help
```

Expand Down
10 changes: 9 additions & 1 deletion example_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ settings:

remote_sources:
-

url: https://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig&showintro=0&mimetype=plaintext
src_type: bind
-
url: https://raw.githubusercontent.com/oznu/dns-zone-blacklist/master/dnsmasq/dnsmasq.blacklist
src_type: dnsmasq
-
url: https://v.firebog.net/hosts/static/w3kbl.txt
src_type: hosts

whitelist:
-

Expand Down
17 changes: 9 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,15 @@ fn main() {
}
match optimize.as_str() {
"speed" => {
(entries_len, rejected_len) = process_parallel_list_to_file(
&path,
&out,
&rejected_b,
&format,
&dns_b,
&pattern,
)
(entries_len, rejected_len) =
process_parallel_list_to_file(
&path,
&out,
&rejected_b,
&format,
&dns_b,
&pattern,
)
}
"memory" => {
(entries_len, rejected_len) =
Expand Down
5 changes: 0 additions & 5 deletions src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,7 @@ pub fn from_config_plain_reslver(ips: &[IpAddr], port: u16, trust_nx: bool) -> R
}

pub fn valid_resolv_domain(domain: &String, resolvers: &LinkedList<Resolver>) -> (bool, usize) {
// let len = resolvers.len();
let mut i = 0;
// let mut rng = rand::thread_rng();

// resolvers.rotate_right(rng.gen_range(1..len - 1));
// resolvers.

for resolver in resolvers {
if resolver.lookup_ip(domain).is_ok() {
Expand Down

0 comments on commit 6b84889

Please sign in to comment.