API14
位于android.net.VpnService

类概述|Class Overview
VpnService is a base class for applications to extend and build their own VPN solutions
//VpnService一个为应用程序扩展和建立自己的VPN解决方案的基类。
In general, it creates a virtual network interface, configures addresses and routing rules, and returns a file descriptor to the application
//通常,它用来创建一个虚拟网联络接口,配置IP地址和路由规则,和返回为应用程序返回一个文件说明符
Each read from the descriptor retrieves an outgoing packet which was routed to the interface. 
//逐行读取说明符将可以检索到通向接口的出站数据包,
Each write to the descriptor injects an incoming packet just like it was received from the interface. 
//逐行写入说明符插入一个进来的数据包就像它从接口接受一样。
The interface is running on Internet Protocol (IP), so packets are always started with IP headers. T
 //这个接口运行在网络协议上,所以数据包总是开始于ip的头部。
 The application then completes a VPN connection by processing and exchanging packets with the remote server over a tunnel.

这个应用程序在一个隧道通过处理和交换数据包来完成VPN的连接。

Letting applications intercept packets raises huge security concerns.
//让应用程序去拦截数据包是会引发很大的安全问题。
  A VPN application can easily break the network. Besides, two of them may conflict with each other.
// 一个VPN应用程序可以很轻易的突破网络,但是两个VPN程序将会引起冲突。
  The system takes several actions to address these issues. Here are some key points:
// 这个系统将会添加一些动作到地址问题(...翻译不出来),这是几个关键点

  • User action is required to create a VPN connection.

用户的动作请求创建VPN连接

  • There can be only one VPN connection running at the same time. The existing interface is deactivated when a new one is created.

在同一个时间只能运行一个VPN连接,当一个新的VPN连接创建的时候已存在的接口将会失效

  • A system-managed notification is shown during the lifetime of a VPN connection.

在VPN连接的时间系统的通知将会始终显现在通知栏。

  • A system-managed dialog gives the information of the current VPN connection. It also provides a button to disconnect.

android会为当前的VPN连接信息提供一个自带的对话框,这个对话框包含一个断开连接的按钮

  • The network is restored automatically when the file descriptor is closed. It also covers the cases when a VPN application is crashed or killed by the system.

当文件说明符关闭的时候网络会自动保存,当VPN应用程序奔溃的时候或被系统kill的时候它会覆盖掉。

There are two primary methods in this class: prepare(Context) and establish()
//在这个类中有两个私有的方法:  prepare(Context) and establish()
 The former deals with user action and stops the VPN connection created by another application. 
//之前的VPN连接将会为其他的VPN应用程序的创建而中止。
 The latter creates a VPN interface using the parameters supplied to the VpnService.Builder.  
//后续创建的VPN接口用的参数支持 VpnService.Builder
 
 An application must call prepare(Context) to grant the right to use other methods in this class, and the right can be revoked at any e.Here are the general steps to create a VPN connection: 
//应用程序必须先调用prepare(Context)来允许使用其他的方法,在任何时候调用...
Here are the general steps to create a VPN connection: //连接VPN的通常步骤:

  1. When the user press the button to connect, call prepare(Context) and launch the returned intent.

第一:当用户按下连接VPN的按钮,调用prepare(Context) 启动返回的Intent.

2.When the application becomes prepared, start the service. 
     第二:当应程序的状态编程prepared的时候,开始启动VPN服务。

3.Create a tunnel to the remote server and negotiate the network parameters for the VPN connection. 
    第三:为VPN连接创建一个远程服务器的隧道,越过网络参数。

4. Supply those parameters to a VpnService.Builder and create a VPN interface by calling establish().  
    第四:为 VpnService.Builder提供参数,调用establish()创建VPN接口。

5.Process and exchange packets between the tunnel and the returned file descriptor. 
    第五:在隧道和返回的说明符之间处理和交换数据包。

6.When onRevoke() is invoked, close the file descriptor and shut down the tunnel gracefully. 
    第六:当onRevoke()调用的时候,关闭这个说明符和优雅的关闭通道。

Services extended this class need to be declared with appropriate permission and intent filter.
//
 

Android英文文档翻译系列(5)——VPNService的更多相关文章

  1. Android英文文档翻译系列(1)——AlarmManager

      原文:个人翻译,水平有限,欢迎看官指正.                                                              public class Ala ...

  2. Android英文文档翻译系列(6)——LocalBroadcastManager

    public class LocalBroadcastManager extends Object java.lang.Object    ↳ android.support.v4.content.L ...

  3. Android英文文档翻译系列(4)——PopupWindow

    public class PopupWindow extends Object //直接继承至Object java.lang.Object ↳ android.widget.PopupWindow  ...

  4. Android英文文档翻译系列(3)——AsyncTask

      AsyncTask——异步任务   个人认为这是翻译比较好的一次.. Class Overview//类概述 AsyncTask enables proper and easy use of th ...

  5. Android英文文档翻译系列(2)——HandlerThread

      public class   HandlerThread extends Thread   Class  Overview Handy class for starting a new threa ...

  6. Android进阶——多线程系列之Thread、Runnable、Callable、Future、FutureTask

    多线程一直是初学者最抵触的东西,如果你想进阶的话,那必须闯过这道难关,特别是多线程中Thread.Runnable.Callable.Future.FutureTask这几个类往往是初学者容易搞混的. ...

  7. Android提升篇系列:Activity recreate(Activity 重新创建/自我恢复)机制(一)

    注:本文中的recreate是指当内存不足时,Activity被回收,但再次来到此Activity时,系统重新恢复的过程.例如:当Activity A到Activity B时,如果内存不足,A被回收, ...

  8. Android控件系列之RadioButton&RadioGroup(转)

    学习目的: 1.掌握在Android中如何建立RadioGroup和RadioButton 2.掌握RadioGroup的常用属性 3.理解RadioButton和CheckBox的区别 4.掌握Ra ...

  9. Android网络编程系列 一 TCP/IP协议族

    在学习和使用Android网路编程时,我们接触的仅仅是上层协议和接口如Apache的httpclient或者Android自带的httpURlconnection等等.对于这些接口的底层实现我们也有必 ...

随机推荐

  1. mybatis深入学习

    最近做的一个活可以让我深入学习一下现在比较流行的ORM框架:mybatis/ibatis的内部原理,SQL的拦截,解析,dataSource和JDBC中做一些额外的事情.如果有可能的话想造一个比较简单 ...

  2. [小技巧]diff的文件夹忽略使用方式

    当我们比较两个文件夹时经常需要忽略.svn或者.git,那么如下 diff -r -x ".git" -x "*.ko" -x "*.o" ...

  3. 一站式学习Wireshark(四):网络性能排查之TCP重传与重复ACK

    作为网络管理员,很多时间必然会耗费在修复慢速服务器和其他终端.但用户感到网络运行缓慢并不意味着就是网络问题. 解决网络性能问题,首先从TCP错误恢复功能(TCP重传与重复ACK)和流控功能说起.之后阐 ...

  4. 常见JVM监控工具用法介绍

    VisualVM是一种集成了多个JDK命令行工具的可视化工具,它能为您提供强大的分析能力.所有这些都是免费的!它囊括的命令行工具包括jps,jstat,jmap,jinfo,jstack,JConso ...

  5. 常用的百度API地图操作

    常用的百度API地图操作,包括模糊搜索,放大缩小,并支持移动端 效果图如下 完整代码: http://download.csdn.net/detail/jine515073/8778167

  6. 开源图形数据库Neo4j介绍与安装

    图形数据库是以图形结构形式存储数据的数据库. https://neo4j.com/ Java 编写 保存为节点以及节点之间的关系 Neo4j 的数据由下面几部分构成: 节点 边 属性 无论是顶点还是边 ...

  7. mysql数据库对时间进行默认的设置

    //----------------------------------------------------------sql语句----------------------------------- ...

  8. Uncaught (in promise) Provided element is not within a Document

    今天在使用html2canvas生成海报的时候,发现报了个如下图所示的错误: 发生这个错误的本质原因是在调用html2canvas的时候传递的是jQuery对象,而不是DOM原生对象. 开始的时候我是 ...

  9. 《FPGA全程进阶---实战演练》第四章之Quartus II使用技巧

    技巧1:“新”技能 hierarchies警告寻找 在编译之后,警告中“hierarchies”这个单词大家估计都很熟悉了,一看到这个警告,基本上就是例化时出现的问题.一般例化时,要是哪个连线没引出, ...

  10. C++ 有用的书籍

    C++ 有用的书籍Essential C++ 中文版C++ Primer Plus 第6版中文版C++ Primer中文版(第5版) #include <iostream> /* run ...