| 
									
										
										
										
											2018-01-08 15:09:33 +01:00
										 |  |  | import ./make-test.nix ({ pkgs, ... }: { | 
					
						
							|  |  |  |   name = "dnscrypt-proxy"; | 
					
						
							|  |  |  |   meta = with pkgs.stdenv.lib.maintainers; { | 
					
						
							|  |  |  |     maintainers = [ joachifm ]; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   nodes = { | 
					
						
							|  |  |  |     # A client running the recommended setup: DNSCrypt proxy as a forwarder | 
					
						
							|  |  |  |     # for a caching DNS client. | 
					
						
							|  |  |  |     client = | 
					
						
							| 
									
										
										
										
											2018-07-20 20:56:59 +00:00
										 |  |  |     { ... }: | 
					
						
							| 
									
										
										
										
											2018-01-08 15:09:33 +01:00
										 |  |  |     let localProxyPort = 43; in | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |       security.apparmor.enable = true; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       services.dnscrypt-proxy.enable = true; | 
					
						
							|  |  |  |       services.dnscrypt-proxy.localPort = localProxyPort; | 
					
						
							|  |  |  |       services.dnscrypt-proxy.extraArgs = [ "-X libdcplugin_example.so" ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       services.dnsmasq.enable = true; | 
					
						
							|  |  |  |       services.dnsmasq.servers = [ "127.0.0.1#${toString localProxyPort}" ]; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   testScript = ''
 | 
					
						
							|  |  |  |     $client->waitForUnit("dnsmasq"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     # The daemon is socket activated; sending a single ping should activate it. | 
					
						
							| 
									
										
										
										
											2018-05-20 02:24:12 +02:00
										 |  |  |     $client->fail("systemctl is-active dnscrypt-proxy"); | 
					
						
							| 
									
										
										
										
											2018-01-08 15:09:33 +01:00
										 |  |  |     $client->execute("${pkgs.iputils}/bin/ping -c1 example.com"); | 
					
						
							| 
									
										
										
										
											2018-05-20 02:24:12 +02:00
										 |  |  |     $client->waitUntilSucceeds("systemctl is-active dnscrypt-proxy"); | 
					
						
							| 
									
										
										
										
											2018-01-08 15:09:33 +01:00
										 |  |  |   '';
 | 
					
						
							|  |  |  | }) |