Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove some sample plugins.

  • Loading branch information...
commit 7c56a3c265f537c215844d1954ba7282c7e4e00d 1 parent ba669b4
@jedisct1 jedisct1 authored
View
3  configure.ac
@@ -438,9 +438,6 @@ AC_CONFIG_FILES([Makefile
src/plugins/example-ldns-forward-after-nxdomain/Makefile
src/plugins/example-logging/Makefile
src/plugins/example-ldns-blocking/Makefile
- src/plugins/example-ldns-opendns-deviceid/Makefile
- src/plugins/example-ldns-opendns-parental-control/Makefile
- src/plugins/example-ldns-opendns-set-client-ip/Makefile
test/Makefile])
AC_OUTPUT
View
5 src/plugins/Makefile.am
@@ -9,8 +9,5 @@ SUBDIRS = \
if USE_LDNS
SUBDIRS += \
example-ldns-blocking \
- example-ldns-forward-after-nxdomain \
- example-ldns-opendns-deviceid \
- example-ldns-opendns-parental-control \
- example-ldns-opendns-set-client-ip
+ example-ldns-forward-after-nxdomain
endif
View
21 src/plugins/example-ldns-opendns-deviceid/Makefile.am
@@ -1,21 +0,0 @@
-
-pkglib_LTLIBRARIES = \
- libdcplugin_example_ldns_opendns_deviceid.la
-
-libdcplugin_example_ldns_opendns_deviceid_la_LIBTOOLFLAGS = --tag=disable-static
-
-libdcplugin_example_ldns_opendns_deviceid_la_SOURCES = \
- example-ldns-opendns-deviceid.c
-
-libdcplugin_example_ldns_opendns_deviceid_la_LIBADD = @LDNS_LIBS@
-
-libdcplugin_example_ldns_opendns_deviceid_la_LDFLAGS = \
- $(AM_LDFLAGS) \
- -avoid-version \
- -export-dynamic \
- -module \
- -no-undefined
-
-libdcplugin_example_ldns_opendns_deviceid_la_CPPFLAGS = \
- $(LTDLINCL) \
- -I../../include
View
105 src/plugins/example-ldns-opendns-deviceid/example-ldns-opendns-deviceid.c
@@ -1,105 +0,0 @@
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <dnscrypt/plugin.h>
-#include <ldns/ldns.h>
-
-DCPLUGIN_MAIN(__FILE__);
-
-#define EDNS_HEADER "0004000f4f70656e444e53"
-#define EDNS_DEV_ID "cafebabedeadbeef"
-
-const char *
-dcplugin_description(DCPlugin * const dcplugin)
-{
- return "Add an OpenDNS device identifier to outgoing queries";
-}
-
-const char *
-dcplugin_long_description(DCPlugin * const dcplugin)
-{
- return
- "Some routers provide advanced support for OpenDNS, and allow using\n"
- "a specific set of settings no matter what their IP address is.\n"
- "\n"
- "Since they don't support dnscrypt, outgoing encrypted queries can\n"
- "not be rewritten by these routers, and OpenDNS will not recognize\n"
- "the router settings.\n"
- "\n"
- "This plugin adds a device identifier to outgoing packets, so that\n"
- "router settings can be used, even when using dnscrypt.\n"
- "\n"
- "When connected without dnscrypt through such a router, the\n"
- "following command will print your device id:\n"
- "\n"
- "$ dig TXT debug.opendns.com\n"
- "\n"
- "Just pass this device id as an argument to this plugin or, if you\n"
- "don't want this information to be visible in the process name,\n"
- "store it in an environment variable named OPENDNS_DEVICE_ID.\n"
- "\n"
- "# dnscrypt-proxy --plugin \\\n"
- " libdcplugin_example_ldns_opendns_deviceid.la,XXXXXXXXXXXXXXXX";
-}
-
-int
-dcplugin_init(DCPlugin * const dcplugin, int argc, char *argv[])
-{
- char *device_id;
- char *edns_hex;
- size_t edns_hex_size = sizeof EDNS_HEADER EDNS_DEV_ID;
-
- edns_hex = malloc(sizeof EDNS_HEADER EDNS_DEV_ID);
- dcplugin_set_user_data(dcplugin, edns_hex);
- if (edns_hex == NULL) {
- return -1;
- }
- memcpy(edns_hex, EDNS_HEADER EDNS_DEV_ID, edns_hex_size);
- assert(sizeof EDNS_DEV_ID - 1U == (size_t) 16U);
- device_id = getenv("OPENDNS_DEVICE_ID");
- if (argc > 1 && strlen(argv[1]) == (size_t) 16U) {
- device_id = argv[1];
- }
- if (device_id != NULL) {
- memcpy(edns_hex + sizeof EDNS_HEADER - (size_t) 1U,
- device_id, sizeof EDNS_DEV_ID);
- }
- return 0;
-}
-
-int
-dcplugin_destroy(DCPlugin *dcplugin)
-{
- free(dcplugin_get_user_data(dcplugin));
-
- return 0;
-}
-
-DCPluginSyncFilterResult
-dcplugin_sync_pre_filter(DCPlugin *dcplugin, DCPluginDNSPacket *dcp_packet)
-{
- uint8_t *new_packet;
- ldns_rdf *edns_data;
- ldns_pkt *packet;
- size_t new_packet_size;
-
- ldns_wire2pkt(&packet, dcplugin_get_wire_data(dcp_packet),
- dcplugin_get_wire_data_len(dcp_packet));
-
- edns_data = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX,
- dcplugin_get_user_data(dcplugin));
- ldns_pkt_set_edns_data(packet, edns_data);
-
- ldns_pkt2wire(&new_packet, packet, &new_packet_size);
- if (dcplugin_get_wire_data_max_len(dcp_packet) >= new_packet_size) {
- dcplugin_set_wire_data(dcp_packet, new_packet, new_packet_size);
- }
-
- free(new_packet);
- ldns_pkt_free(packet);
-
- return DCP_SYNC_FILTER_RESULT_OK;
-}
View
21 src/plugins/example-ldns-opendns-parental-control/Makefile.am
@@ -1,21 +0,0 @@
-
-pkglib_LTLIBRARIES = \
- libdcplugin_example_ldns_opendns_parental_control.la
-
-libdcplugin_example_ldns_opendns_parental_control_la_LIBTOOLFLAGS = --tag=disable-static
-
-libdcplugin_example_ldns_opendns_parental_control_la_SOURCES = \
- example-ldns-opendns-parental-control.c
-
-libdcplugin_example_ldns_opendns_parental_control_la_LIBADD = @LDNS_LIBS@
-
-libdcplugin_example_ldns_opendns_parental_control_la_LDFLAGS = \
- $(AM_LDFLAGS) \
- -avoid-version \
- -export-dynamic \
- -module \
- -no-undefined
-
-libdcplugin_example_ldns_opendns_parental_control_la_CPPFLAGS = \
- $(LTDLINCL) \
- -I../../include
View
62 src/plugins/example-ldns-opendns-parental-control/example-ldns-opendns-parental-control.c
@@ -1,62 +0,0 @@
-
-#include <stdio.h>
-#include <string.h>
-
-#include <dnscrypt/plugin.h>
-#include <ldns/ldns.h>
-
-DCPLUGIN_MAIN(__FILE__);
-
-const char *
-dcplugin_description(DCPlugin * const dcplugin)
-{
- return "Apply extended OpenDNS parental controls";
-}
-
-const char *
-dcplugin_long_description(DCPlugin * const dcplugin)
-{
- return
- "This enables the following filter set, if one hasn't been defined\n"
- "for the current network or device:\n"
- "- lingerie/bikini\n"
- "- adult themes\n"
- "- nudity\n"
- "- pornography\n"
- "- proxy/anonymizer\n"
- "- sexuality\n"
- "- tasteless";
-}
-
-int
-dcplugin_init(DCPlugin * const dcplugin, int argc, char *argv[])
-{
- return 0;
-}
-
-DCPluginSyncFilterResult
-dcplugin_sync_pre_filter(DCPlugin *dcplugin, DCPluginDNSPacket *dcp_packet)
-{
- uint8_t *new_packet;
- ldns_rdf *edns_data;
- ldns_pkt *packet;
- size_t new_packet_size;
-
- ldns_wire2pkt(&packet, dcplugin_get_wire_data(dcp_packet),
- dcplugin_get_wire_data_len(dcp_packet));
-
- edns_data = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX,
- "000400084f70656e444e53"
- "ff");
- ldns_pkt_set_edns_data(packet, edns_data);
-
- ldns_pkt2wire(&new_packet, packet, &new_packet_size);
- if (dcplugin_get_wire_data_max_len(dcp_packet) >= new_packet_size) {
- dcplugin_set_wire_data(dcp_packet, new_packet, new_packet_size);
- }
-
- free(new_packet);
- ldns_pkt_free(packet);
-
- return DCP_SYNC_FILTER_RESULT_OK;
-}
View
21 src/plugins/example-ldns-opendns-set-client-ip/Makefile.am
@@ -1,21 +0,0 @@
-
-pkglib_LTLIBRARIES = \
- libdcplugin_example_ldns_opendns_set_client_ip.la
-
-libdcplugin_example_ldns_opendns_set_client_ip_la_LIBTOOLFLAGS = --tag=disable-static
-
-libdcplugin_example_ldns_opendns_set_client_ip_la_SOURCES = \
- example-ldns-opendns-set-client-ip.c
-
-libdcplugin_example_ldns_opendns_set_client_ip_la_LIBADD = @LDNS_LIBS@
-
-libdcplugin_example_ldns_opendns_set_client_ip_la_LDFLAGS = \
- $(AM_LDFLAGS) \
- -avoid-version \
- -export-dynamic \
- -module \
- -no-undefined
-
-libdcplugin_example_ldns_opendns_set_client_ip_la_CPPFLAGS = \
- $(LTDLINCL) \
- -I../../include
View
122 src/plugins/example-ldns-opendns-set-client-ip/example-ldns-opendns-set-client-ip.c
@@ -1,122 +0,0 @@
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <dnscrypt/plugin.h>
-#include <ldns/ldns.h>
-#include <ldns/util.h>
-
-DCPLUGIN_MAIN(__FILE__);
-
-#define EDNS_HEADER "4f56" "0014" "4f444e5300" "00"
-#define EDNS_HEADER_CLIENT_IP "10"
-#define EDNS_CLIENT_IP "7f000001"
-#define EDNS_HEADER_FODDER "40"
-#define EDNS_FODDER "deadbeefabad1dea"
-
-#define EDNS_DATA EDNS_HEADER \
- EDNS_HEADER_CLIENT_IP EDNS_CLIENT_IP EDNS_HEADER_FODDER EDNS_FODDER
-
-#define EDNS_CLIENT_IP_OFFSET (sizeof EDNS_HEADER - 1U + \
- sizeof EDNS_HEADER_CLIENT_IP - 1U)
-
-#define EDNS_FODDER_OFFSET (sizeof EDNS_HEADER - 1U + \
- sizeof EDNS_HEADER_CLIENT_IP - 1U + \
- sizeof EDNS_CLIENT_IP - 1U + \
- sizeof EDNS_HEADER_FODDER - 1U)
-
-const char *
-dcplugin_description(DCPlugin * const dcplugin)
-{
- return "Apply the OpenDNS settings defined for a specific IP address";
-}
-
-const char *
-dcplugin_long_description(DCPlugin * const dcplugin)
-{
- return
- "If you defined a policy for your network, this plugin allows\n"
- "using this policy no matter where you are, and without interfering\n"
- "with the networks you are roaming on.\n"
- "This plugin also allows using your IPv4 network settings even when\n"
- "connecting to OpenDNS using IPv6.\n"
- "\n"
- "The IP address must be a hex-encoded IPv4 address.\n"
- "\n"
- "Usage:\n"
- "\n"
- "# dnscrypt-proxy --plugin \\\n"
- " libdcplugin_example_ldns_opendns_set_client_ip.la,7f000001";
-}
-
-int
-dcplugin_init(DCPlugin * const dcplugin, int argc, char *argv[])
-{
- char *edns_hex;
- size_t edns_hex_size = sizeof EDNS_DATA;
-
- ldns_init_random(NULL, 0U);
- edns_hex = malloc(edns_hex_size);
- dcplugin_set_user_data(dcplugin, edns_hex);
- if (edns_hex == NULL) {
- return -1;
- }
- memcpy(edns_hex, EDNS_DATA, edns_hex_size);
- assert(sizeof EDNS_CLIENT_IP - 1U == (size_t) 8U);
- if (argc > 1 && strlen(argv[1]) == (size_t) 8U) {
- memcpy(edns_hex + EDNS_CLIENT_IP_OFFSET,
- argv[1], sizeof EDNS_CLIENT_IP - 1U);
- }
- return 0;
-}
-
-int
-dcplugin_destroy(DCPlugin *dcplugin)
-{
- free(dcplugin_get_user_data(dcplugin));
-
- return 0;
-}
-
-static void
-fill_with_random_hex_data(char * const str, size_t size)
-{
- size_t i = (size_t) 0U;
- uint16_t rnd;
-
- while (i < size) {
- rnd = ldns_get_random();
- str[i++] = "0123456789abcdef"[rnd & 0xf];
- str[i++] = "0123456789abcdef"[(rnd >> 8) & 0xf];
- }
-}
-
-DCPluginSyncFilterResult
-dcplugin_sync_pre_filter(DCPlugin *dcplugin, DCPluginDNSPacket *dcp_packet)
-{
- uint8_t *new_packet;
- ldns_rdf *edns_data;
- char *edns_data_str;
- ldns_pkt *packet;
- size_t new_packet_size;
-
- ldns_wire2pkt(&packet, dcplugin_get_wire_data(dcp_packet),
- dcplugin_get_wire_data_len(dcp_packet));
-
- edns_data_str = dcplugin_get_user_data(dcplugin);
- fill_with_random_hex_data(edns_data_str + EDNS_FODDER_OFFSET,
- sizeof EDNS_FODDER - 1U);
- edns_data = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, edns_data_str);
- ldns_pkt_set_edns_data(packet, edns_data);
-
- ldns_pkt2wire(&new_packet, packet, &new_packet_size);
- if (dcplugin_get_wire_data_max_len(dcp_packet) >= new_packet_size) {
- dcplugin_set_wire_data(dcp_packet, new_packet, new_packet_size);
- }
-
- free(new_packet);
- ldns_pkt_free(packet);
-
- return DCP_SYNC_FILTER_RESULT_OK;
-}
Please sign in to comment.
Something went wrong with that request. Please try again.