Skip to main content

Example

Along with the source code of the library, a small sample project is supplied, designed to test the functionality of the library. The source code of the project is in \liburl2cat\example

Also in this directory, you will find:

  • grandbase.db - sample of a SafeDNS database;
  • domains.csv - a file containing domains from the sample database
  • url2cat.ini - a configuration file that specifies credentials for access to downloading and updating the database, updating paths, etc.

url2cat.ini file contains the following fields:

cache_size=0
db_name=grandbase.db
db_update_host=url2cat.safedns.com
db_update_path=/api/v1/update
db_download_path=/pubfilter/grandbase.db
db_update_user=username
db_update_password=password
db_user_version=00000000
server_host=x.api.safedns.com
server_path=/domain
server_user=username
server_password=password
recat_host=www.safedns.ru
recat_path=/api/json/v2
recat_user=username
recat_password=password

After configuration and assembly, the client file will appear in the /liburl2cat/build/bin directory. Move the following files from \liburl2cat\example to this directory:

  • grandbase.db
  • url2cat.ini

The client uses the domains.csv file as the source of domains/URLs for verification. You can create this file from the command line:

echo "facebook.com / /" >> domains.csv

To start the client, use ./clent command.