Android VpnService, VPN Proxy

 VpnService, Android 4.0 start (API LEVEL 15) from, bring a solution to help build a VPN connection on the device, and does not require root privileges.
 public class MyVpnService extends VpnService {}, android.permission.BIND_VPN_SERVICE " permission.
 VpnService is a base class for applications to expand and build their own VPN solution. Typically, it creates a virtual network interface, configure address and routing rules, and returns a file to the application described. description will read to retrieve each time a packet is routed to the output interface. each write a description will inject input packet received from the interface like. this interface runs the IP protocol, so these packages always begins in the IP header. remote server to process and exchange data packets on the application using the channel to achieve the VPN connection.
  Android vpn catch vpnservice.VPNService http packet of data is actually the role of blocking access network and to access the application provides a packet data network interface, instead of real data to achieve the agency's functions, need to do some other action if needed to achieve data agency services, to get the message.
  VPNService is a android vpn service comes with class, it can not root your phone Under the circumstances, you realize the mobile phone traffic control can be specified by setting the interception of application traffic, you can do a global operation. If you want to intercept network application, or if you want to get the network data forwarding network data, We can do it through this.

Android VPNServic- native framework https://blog.csdn.net/qq_36999880/article/details/87913712
android VpnService- https://www.jianshu.com/p/966cfb9bdc49

Free android root firewall -VpnService- https://blog.csdn.net/zhao007z5/article/details/80021971
various protocol encapsulation - https://github.com/search?utf8=%E2%9C%93&q=NetGuard&type=
{class IP4Header public
    public byte Version;
    public byte the IHL;
    public int headerLength;
    public Short TypeOfService;
    public int TotalLength;

    public int identificationAndFlagsAndFragmentOffset;

    public short TTL;
    private short protocolNum;
    public TransportProtocol protocol;
    public int headerChecksum;

    public InetAddress sourceAddress;
    public InetAddress destinationAddress;
}

public class TCPHeader {
    public static final int FIN = 0x01;
    public static final int SYN = 0x02;
    public static final int RST = 0x04;
    public static final int PSH = 0x08;
    public static final int ACK = 0x10;
    public static final int URG = 0x20;

    public int sourcePort;
    public int destinationPort;

    public long sequenceNumber;
    public long acknowledgementNumber;

    public byte dataOffsetAndReserved;
    public int headerLength;
    public byte flags;
    public int window;

    public int checksum;
    public int urgentPointer;

    public byte[] optionsAndPadding;
}
public static class UDPHeader {
    public int sourcePort;
    public int destinationPort;

    public int length;
    public int checksum;
}

    public static final int FIN = 0x01;
    public static final int SYN = 0x02;
    public static final int RST = 0x04;
    public static final int PSH = 0x08;
    public static final int ACK = 0x10;
    public static final int URG = 0x20;

Guess you like

Origin blog.csdn.net/ShareUs/article/details/90611703
VPN