Coder Social home page Coder Social logo

simple-vpn-demo's Introduction

About Code

This code serves as a VPN server for NE PacketTunnel Illustration, everything means to be very simple and just illustrate basic principles about VPN.

Inspired by simpletun, mptun and ShadowVPN.

Usage & Configuration

Just compile and run on Linux machines, all configurations are at the beginning of source code vpn.c as C #define macros.

License

The MIT License (MIT)

Copyright (c) 2016 lxd.me

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

simple-vpn-demo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simple-vpn-demo's Issues

never actually connects

I'm having connection problem.
I set it up on DigitalOcean. But I never got a VPN connection.
What should I be server ip ? digitalocean server ip ?

ekran resmi 2017-04-30 21 19 22

img_2055

fatal error: 'linux/if_tun.h'

I am trying to compile it on macOS Sierra and getting the following error.

gcc -o vpn vpn.c -g -Wall
vpn.c:14:10: fatal error: 'linux/if_tun.h' file not found
#include <linux/if_tun.h>
^
1 error generated.
make: *** [vpn] Error 1

Crashes after a while

Terminal log:

write tun_fd error: Invalid argument
Execute iptables -t nat -D POSTROUTING -s 10.8.0.0/16 ! -d 10.8.0.0/16 -m comment --comment 'vpndemo' -j MASQUERADE
Execute iptables -D FORWARD -s 10.8.0.0/16 -m state --state RELATED,ESTABLISHED -j ACCEPT
Execute iptables -D FORWARD -d 10.8.0.0/16 -j ACCEPT

FD_ISSET(tun_fd, &readset) always returns false

我把这个demo deploy到本地的一个linux机器一切正常,然后我尝试把这个跑在阿里云,udp打开相关端口,但是手机端连上去以后,server 输出只有:

Writing to tun 59 bytes ...
Writing to tun 60 bytes ...
Writing to tun 81 bytes ...
Writing to tun 57 bytes ...
Writing to tun 58 bytes ...
Writing to tun 58 bytes ...
Writing to tun 71 bytes ...
Writing to tun 71 bytes ...
Writing to tun 71 bytes ...

似乎tun_fd永远没被set,请问有什么debug的想法吗

can't visit webside as google

can't visit webside as google
i make it . server and client in two linux host;
it can send udp package.
but client can't visit google webside by server

tcp

hello, i want to run this on tcp instead of udp.

I understand that it is slower but nonetheless i want to do it

i replaced all udp and UDP text in the vpn.c file with tcp or TCP but now on run i get this:

gcc -o vpn vpn.c -g -Wall
vpn.c: In function ‘tcp_bind’:
vpn.c:142:23: error: ‘IPPROTO_tcp’ undeclared (first use in this function)
hints.ai_protocol = IPPROTO_tcp;
^
vpn.c:142:23: note: each undeclared identifier is reported only once for each function it appears in
Makefile:2: recipe for target 'vpn' failed
make: *** [vpn] Error 1

Server Software

What protocol does this server use? This server is not support multiple connections. Are there any ready server software that can provide this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.