2017 © Pedro Peláez
 

yii2-extension yii2-webrtc-get-client-local-ip

using webrtc, get client local ip by javascript in some browser, such as firefox, chrome and opera.

image

bubifengyun/yii2-webrtc-get-client-local-ip

using webrtc, get client local ip by javascript in some browser, such as firefox, chrome and opera.

  • Monday, June 20, 2016
  • by bubifengyun
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

通过 Webrtc 获得客户端本地 IP

Get Client Local Ip by Webrtc

博客原文:http://my.oschina.net/bubifengyun/blog/690253, (*1)

示例代码,请勿用于生产环境!, (*2)

Just a demo, Do not use in production envrionment!, (*3)

由于网站只可以运行在局域网,随想获取本地 IP 地址,作为一个验证项。虽然可以通过设置假的 IP 来欺骗服务器,但也能在一定程度上做到仅限于特定IP的电脑访问。, (*4)

适用于支持 WebRTC 的浏览器,比如火狐、谷歌等。且这些浏览器没有关闭 WebRTC 获得本地 IP 的功能。, (*5)

using webrtc, get client local ip by javascript in some browser, such as firefox, chrome and opera., (*6)

安装

Installation

The preferred way to install this extension is through composer., (*7)

Either run, (*8)

php composer.phar require --prefer-dist bubifengyun/yii2-webrtc-get-client-local-ip "*"

or add, (*9)

"bubifengyun/yii2-webrtc-get-client-local-ip": "*"

to the require section of your composer.json file., (*10)

用法

Usage

Once the extension is installed, simply use it in your code by :, (*11)

        = $form
            ->field($model, 'ip')
            ->widget(\bubifengyun\WebrtcGetClientLocalIp\WebRTCLocalIPWidget::className(), [
                'id' => 'loginform-ip',
                'hidden' => true,
            ]) ?>

Note + 'id' => 'loginform-ip', id was seen from source code. + id 是从浏览器查看源码看到的,暂时不会设置该 id, (*12)

参考

Ref

  • http://stackoverflow.com/questions/391979/how-to-get-clients-ip-address-using-javascript-only
  • https://github.com/diafygi/webrtc-ips
  • http://www.yiichina.com/tutorial/459
  • http://www.html-js.com/article/Learn-JavaScript-every-day-to-understand-what-JavaScript-Promises

The Versions

20/06 2016

dev-master

9999999-dev

using webrtc, get client local ip by javascript in some browser, such as firefox, chrome and opera.

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar bubifengyun

extension yii2 javascript ip webrtc