最近基于APRS(自动位置报告系统,Automatic Position Reporting System)的原理,在互联网上实现了一个类似的系统。系统的源码在这里。
A system, basing on principles similar to APRS(Automatic Position Reporting System, is implemented. This system runs in the Internet. Source code is here.
想法是类似的,APRS就是一个人广播自己的位置,然后这个信号被一个接受者收到之后,被重复,加大功率,然后被广播得更广阔。有些接受者会将记录的包放到互联网。
The idea is simple. APRS lets one broadcasts its position, and the signal is received by another DIGIPEATER and repeated. Then the signal is broadcast-ed more widely. Some receiver will put the received packet into Internet.
对于互联网来说,现存的应用,比如电子邮件、即时消息、微信等等,都可以用来传输短信。这类应用在传递数据时,其途径不算很多。这里设计的NPBS系统,基于各个点的广播,虽然效率低,而且无法承受大流量的冲击,但是相比之下可靠性比较好,单就信息一定会发出去而言。但是时效性上,本系统比较差。
Existing Applications in Internet, such as Emails, IMs, or WeChat, can all be used to transmit short messages. But these applications have limited paths in transmitting such data. NPBS as here designed, is based on broadcasting at nodes. Although it have lower efficiency, and vulnerable to mass traffics, it is more robust, when the transmission of messages is concerned. But when referring to punctuality, it has disadvantage.
NPBS系统利用URL的参数,传输一个包,一个字符串。这个包的格式定义在源码里有。包的最大长度是1655字节,由不影响URL编码规则的字符构成,区分大小写。一个包的内容,包括一个开头(说明NPBS和版本),一个标识(类似呼号),一个TTL值(从发包开始的255,每次经过一个转发就递减),一个对数据的SHA1校验值,兼作包避免重发的检验值。
The NPBS System utilizes parameters in URL to transmit a packet, which is a string. The definition of the packet is in the source code(above). The max. length of a packet is 1655 bytes, constructed of characters which will not be encoded but case-sensitive. A packet consists of a HEAD(NPBS1, 1 for version), a LABEL(like a call-sign), a TTL(begin with 255 and reduced by 1 each time the packet is forwarded), a CHECKSUM using SHA1 of the data, to check the integrity of data and to drop duplicated packets.
数据用Base64编码,允许任意实际内容存储在里面。Base64的+、/、=分别用_、-、*代替。
The data is encoded in base64, thus allowing arbitrary data stored. The characters ‘+’, ‘/’, ‘=’ in Base64 are relatively replaced with ‘_’, ‘-’, ‘*’.
当前用PHP实现了这个系统,并有一个带有复杂的验证码的界面。这个实现不依赖数据库,只要有对文件的读写权限即可。
Currently a implementation in PHP is available, with a complex CAPTCHA(Chinese characters inputting expected, however one have a 10% possibility to get a mathematics CAPTCHA). This implementation does not rely on database, only on authorities of reading and writing local files.
The entrance to this system in this website is here:
本系统在本站已经部署一个入口:http://www.neoatlantis.org/npbs/index.php