0.0.11 • Published 10 years ago

wrtc-ice-cand-parse v0.0.11

Weekly downloads
162
License
MIT
Repository
github
Last release
10 years ago

npm version Build Status Coverage Status

Dependency Status devDependency Status

wrtc-ice-cand-parse

WRTC Ice Candidate parse

This package is part of WRTC project.

Not yet ready for public usage.

Small helper to parse WebRTC ICE candidates string

'candidate:2 1 UDP 92274687 12.123.12.123 12345 typ relay raddr 12.123.12.123 rport 54321'

to JSON object

{ foundation: '2',
  component_id: '1',
  transport: 'UDP',
  priority: '92274687',
  localIP: '12.123.12.123',
  localPort: '12345',
  type: 'relay',
  remoteIP: '12.123.12.123',
  remotePort: '54321',
  generation: undefined }

and stringify it back.

If some field is not present in original strig,

If you have different needs regarding the functionality, please add a feature request.

Installation

npm install --save wrtc-ice-cand-parse

Usage

Not yet ready for public usage.

'type' and 'transport' properties are case-sensitive, i.e. type 'TCP' and type 'tcp' are different, to compare you need to lowerCase them.

Methods

parse

stringify

validate

Example

File examples/parse.js:

//iceParse = require('wrtc-ice-cand-parse');
var iceParse = require('../index.js');

var origStr = 'candidate:2 1 UDP 92274687 12.123.12.123 12345 typ relay raddr 12.123.12.123 rport 54321';

var candObj = iceParse.parse(origStr);
console.log('candObj:', candObj);

console.log('validate():', iceParse.validate(candObj));

var candStr = iceParse.stringify(candObj);
console.log('candStr:', candStr);
node examples/parse.js 
candObj: { foundation: '2',
  component_id: '1',
  transport: 'UDP',
  priority: '92274687',
  localIP: '12.123.12.123',
  localPort: '12345',
  type: 'relay',
  remoteIP: '12.123.12.123',
  remotePort: '54321',
  generation: undefined }
validate(): true
candStr: candidate:2 1 UDP 92274687 12.123.12.123 12345 typ relay raddr 12.123.12.123 rport 54321
0.0.11

10 years ago

0.0.10

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago