<commit_before># resolver-nss

A libnss plugin for add support `/etc/resolver/*` to set extra nameservers like a Mac OS X.

This is still a work in progress!

## Installing

### From package

Coming soon...

### From source
```bash
$ git clone https://github.com/azukiapp-samples/resolver-nss
$ cd resolver-nss
$ sudo make all install
$ sudo sed -i -re 's/^(hosts: .*$)/\1 resolver/' /etc/nsswitch.conf
```

or edit `/etc/nsswitch.conf`:

```config
# Normally
hosts: files dns resolver
#                ^
# If you have avahi (Zeroconf) installed
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 resolver
#                                                      ^
```

## Inspiration

This project is inspiration in similar [feature][mac_resolver] that is present in Mac OS X.

The code was based on another project code: [docker nss][docker_nss].

## More references

Simple c-ares example: https://gist.github.com/mopemope/992777
Use a dns server in c-ares: https://github.com/bagder/c-ares/blob/master/adig.c

## License

"Azuki", "Azk" and the Azuki logo are copyright (c) 2013-2014 Azuki Serviços de Internet LTDA.

Azk source code is released under Apache 2 License.

Check LEGAL and LICENSE files for more information.

[mac_resolver]: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/resolver.5.html
[docker_nss]: https://github.com/danni/docker-nss<commit_msg>Upgrading README to use azk for build libnss_resolver<commit_after># libnss_resolver

A Linux extension that adds support the `/etc/resolver/*`,a means to support different "nameserver"
to specific suffixes, in a similar fashion to that which is supported on Mac OS X.

This is still a work in progress!

## Installing

### From package

Coming soon...

### From the source

First: install https://azk.io.

And after that:

```bash
$ git clone https://github.com/azukiapp-samples/nss_resolver
$ cd resolver-nss
# build
$ azk shell build -t -c "scons"

# Run tests
$ azk start dns # Run a mock dns server to test
$ azk shell build -t -c "./build/test"

# Install local
$ azk shell --mount /usr/lib:/azk/lib -c "scons install"
```

Now you can add the resolver-nss in resolution pipe:

```bash
$ sudo sed -i -re 's/^(hosts: .*$)/\1 resolver/' /etc/nsswitch.conf
```

or edit `/etc/nsswitch.conf`:

```config
# Normally       ↓
hosts: files dns resolver
# But, if you have avahi (Zeroconf) installed          ↓
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 resolver
```

## References

Inspiration code: https://github.com/danni/docker-nss
Mac OS X resolver feature: [https://developer.apple.com/library/...](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/resolver.5.html)
Simple c-ares example: https://gist.github.com/mopemope/992777
Use a dns server in c-ares: https://github.com/bagder/c-ares/blob/master/adig.c
Ip and port format: https://sourceware.org/bugzilla/show_bug.cgi?id=14242
Use blocks in linux: http://mackyle.github.io/blocksruntime/

## License

"Azuki", "Azk" and the Azuki logo are copyright (c) 2013-2014 Azuki Serviços de Internet LTDA.

Azk source code is released under Apache 2 License.

Check LEGAL and LICENSE files for more information.
{'fraction_non_alphanumeric': 0.12033582089552239, 'fraction_numerical': 0.013992537313432836, 'mean_word_length': 3.628776978417266, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 13, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7259118', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1069, 'n_words': 352}