-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathtest.conf
49 lines (35 loc) · 1022 Bytes
/
test.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
user nginx;
worker_processes auto;
load_module modules/ngx_stream_js_module.so;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http { }
# DNS Stream Services
stream {
# DNS logging
log_format dns '$remote_addr [$time_local] $protocol $status $bytes_sent $bytes_received "$dns_qname" "$upstream_addr"';
access_log /var/log/nginx/dns-access.log dns;
# Import the NJS module
js_import /etc/nginx/njs.d/dns/test.js;
# The $dns_qname variable can be populated by preread calls, and can be used for DNS routing
js_set $dns_qname test.get_qname;
# test server - responds to dns queries
server {
listen 5553;
listen 5553 udp;
js_var $test_result;
js_preread test.test_dns_encoder;
return $test_result;
}
# load balance to test server and parse responses
server {
listen 5554;
listen 5554 udp;
proxy_responses 1;
js_filter test.test_dns_decoder;
proxy_pass 127.0.0.1:5553;
}
}