5.12.4. Class DirectedRouter

This class implements directed routing, which means that the destination address is a preset address for each session.

Example 5.33. DirectedRouter example

The following service uses a DirectedRouter that redirects every connection to the /var/sample.socket Unix domain socket.

Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrUnix('/var/sample.socket'), overrideable=FALSE, forge_addr=FALSE))

The following service uses a DirectedRouter that redirects every connection to the 192.168.2.24:8080 IP address.

Service(name="demo_service", proxy_class=HttpProxy, router=DirectedRouter(dest_addr=SockAddrInet('192.168.2.24', 8080), overrideable=FALSE, forge_addr=FALSE))