• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ip.address函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ip.address函数的典型用法代码示例。如果您正苦于以下问题:TypeScript address函数的具体用法?TypeScript address怎么用?TypeScript address使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了address函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1:

 server.start((err: any) => {
     if (err) {
         throw err;
     } else {
         console.log(`Server running at: http://${Ip.address()}:${server.info.port}`);
     }
 });
开发者ID:ARA-Tester,项目名称:ARA-Tester,代码行数:7,代码来源:index.ts


示例2: log

export async function log(log: LogInterface): Promise<boolean> {
    if (!log.userId) {
        log.userId = null;
    }

    if (!log.module) {
        log.module = '';
    }
    log.module = log.module.toLowerCase();

    if (!log.type) {
        log.type = '';
    }

    const newLog = new MoLogs();

    newLog.module = log.module;
    newLog.type = log.type;
    newLog.date = new Date();
    newLog.ip = address();
    newLog.info = log.info;
    newLog.userId = log.userId;

    await getConnection().getRepository(MoLogs).save(newLog);

    return true;
}
开发者ID:Maxtream,项目名称:themages-cms,代码行数:27,代码来源:log.ts


示例3: checkBruteForce

    private async checkBruteForce(): Promise<boolean> {
        // Remove timed out IPs
        this.timeOutAuthAttempts(true);

        try {
            // Fetching previous attempts to login
            const response = await getConnection().getRepository(MoUsersAuthAttempts)
                .findOne({
                    ip: address()
                });

            if (response && response.attempts >= this.availableLoginAttempts) {
                // Immediately trigger response as false to block off bruteforce
                return false;
            }
            if (response) {
                // In case there were already attempts, we're incrementing the attempt
                response.attempts++;
                await getConnection().getRepository(MoUsersAuthAttempts).save(response);
            } else {
                // Saving first attempt from this IP address
                const usersAuthAttempts: MoUsersAuthAttempts = new MoUsersAuthAttempts();

                usersAuthAttempts.attempts = 1;
                usersAuthAttempts.timestamp = new Date();
                usersAuthAttempts.ip = address();
                await getConnection().getRepository(MoUsersAuthAttempts).save(usersAuthAttempts);
            }

            return true;
        } catch (error) {
            return false;
        }

        return true;
    }
开发者ID:Maxtream,项目名称:themages-cms,代码行数:36,代码来源:login.ts


示例4: appStarted

  // Called when express.js app starts on given port w/o errors
  public static appStarted(port: number, tunnelStarted?: string) {
    console.log(`Server started ${chalk.green('✓')}`);

    // If the tunnel started, log that and the URL it's available at
    if (tunnelStarted) {
      console.log(`Tunnel initialised ${chalk.green('✓')}`);
    }

    console.log(`
${chalk.bold('Access URLs:')}${divider}
Localhost: ${chalk.magenta(`http://localhost:${port}`)}
      LAN: ${chalk.magenta(`http://${ip.address()}:${port}`) +
(tunnelStarted ? `\n    Proxy: ${chalk.magenta(tunnelStarted)}` : '')}${divider}
${chalk.blue(`Press ${chalk.italic('CTRL-C')} to stop`)}
    `);
  }
开发者ID:StrikeForceZero,项目名称:react-boilerplate,代码行数:17,代码来源:logger.ts


示例5: timeOutAuthAttempts

    private async timeOutAuthAttempts(timer: boolean = false): Promise<boolean> {
        const findByRules = {
            ip: address(),
            timestamp: null
        };

        // Just in case if we need to check by timestamp
        if (timer) {
            findByRules.timestamp = LessThan(format(subMinutes(new Date(), 5), 'YYYY-MM-DD HH:mm:ss'));
        }

        // Fetching attempts
        const response = await getConnection().getRepository(MoUsersAuthAttempts).find(findByRules);

        // Cleaning up outdated attempts
        if (response) {
            await getConnection().getRepository(MoUsersAuthAttempts).remove(response);
        }

        return true;
    }
开发者ID:Maxtream,项目名称:themages-cms,代码行数:21,代码来源:login.ts


示例6: startServerProcess

import child_process from 'child_process';
import chokidar from 'chokidar';
import ip from 'ip';
import path from 'path';
const address = ip.address();
let timeout;
let serverProcess: child_process.ChildProcess;

// start building
const buildProcess = child_process.spawn('npm', ['run', 'build'], {
  env: {
    ...process.env,
    LOCAL_IP: address,
  },
  stdio: [0, 1, 2],
});

startServerProcess();

// watch file change and restart server
const watcher = chokidar
  .watch([path.resolve(__dirname, './'), path.resolve(__dirname, '../web/common')])
  .on('add', startServerProcess)
  .on('change', startServerProcess)
  .on('unlink', startServerProcess);

function startServerProcess(f?: string) {
  clearTimeout(timeout);
  timeout = setTimeout(() => {
    if (f) {
      console.info(f + ' changed, restart server...');
开发者ID:whxaxes,项目名称:slither,代码行数:31,代码来源:dev.ts


示例7:

import * as Ip from 'ip';
import { Config } from './../share/config';

const host: string = `${Ip.address()}:${Config.PORT}`;

process.once('loaded', () => {
  global['appHost'] = host;
});
开发者ID:ARA-Tester,项目名称:ARA-Tester,代码行数:8,代码来源:preload.ts


示例8: EventEmitter

 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import {EventEmitter} from 'events';
import ip from 'ip';
import {ITrace} from './types';

const pid = process.pid;
const ipAddr = ip.address();

export const msg = new EventEmitter();

export const isDevEnv = process.env.NODE_ENV !== 'production';

/**
 * yes, just do nothing.
 */
export const noop = () => {};

/**
 * trace log
 * @param info
 */
export const trace = (obj: ITrace) => {
开发者ID:hufeng,项目名称:node-jsonrpc-dubbo,代码行数:31,代码来源:util.ts



注:本文中的ip.address函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ip.fromLong函数代码示例发布时间:2022-05-25
下一篇:
TypeScript ios-mobileprovision-finder.provision类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap