Home | History | Annotate | Download | only in toyvpn

Lines Matching defs:tunnel

95             // tries to recreate the tunnel without shutting down everything.
100 // We try to create the tunnel for several times. The better way
133 DatagramChannel tunnel = null;
136 // Create a DatagramChannel as the VPN tunnel.
137 tunnel = DatagramChannel.open();
139 // Protect the tunnel before connecting to avoid loopback.
140 if (!protect(tunnel.socket())) {
141 throw new IllegalStateException("Cannot protect the tunnel");
145 tunnel.connect(server);
148 // writing. Here we put the tunnel into non-blocking mode.
149 tunnel.configureBlocking(false);
152 handshake(tunnel);
167 // We use a timer to determine the status of the tunnel. It
180 // Write the outgoing packet to the tunnel.
182 tunnel.write(packet);
194 // Read the incoming packet from the tunnel.
195 length = tunnel.read(packet);
228 tunnel.write(packet);
248 tunnel.close();
256 private void handshake(DatagramChannel tunnel) throws Exception {
257 // To build a secured tunnel, we should perform mutual authentication
271 tunnel.write(packet);
280 int length = tunnel.read(packet);