jaguar_ipnet 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 0

jaguar_ipnet

An extensive library to handle IP addresses

Usage

A simple usage example:

import 'package:jaguar_ipnet/jaguar_ipnet.dart';

main() {
  final Ip4 ip = Ip4.parse('192.67.148.100');

  print(ip[0]);  // Should print `192`
  print(ip[1]);  // Should print `67`
  print(ip[2]);  // Should print `148`
  print(ip[3]);  // Should print `100`

  print(ip.a);  // Should print `192`
  print(ip.b);  // Should print `67`
  print(ip.c);  // Should print `148`
  print(ip.d);

  print(ip.toString());  // Should print `192.67.148.100`

  print(Ip4.classAMask.cidrLen);  // Should print `8`
  print(Ip4.classBMask.cidrLen);  // Should print `16`
  print(Ip4.classCMask.cidrLen);  // Should print `24`

  print(ip.masked(Ip4.classBMask));  // Should print `192.67.0.0`;

  final Ip4Net net = Ip4Net.parseCIDR('192.67.148.100/16');

  print(net.network);  // Should print `192.67.0.0`;
  print(net.mask);  // Should print `255.255.0.0`;

  print(net.toString());  // Should print `192.67.0.0/16`;

  print(net.mask.cidrLen);  // Should print `16`;

  print(net.contains(Ip4.parse('192.67.148.27')));  // Should print `true`;
  print(net.contains(Ip4.parse('192.68.148.27')));  // Should print `false`;
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.1

  • Initial version, created by Stagehand

example/jaguar_ipnet_example.dart

// Copyright (c) 2017, SERAGUD. All rights reserved. Use of this source code
// is governed by a BSD-style license that can be found in the LICENSE file.

import 'package:jaguar_ipnet/jaguar_ipnet.dart';

main() {
  final Ip4 ip = Ip4.parse('192.67.148.100');

  print(ip[0]);  // Should print `192`
  print(ip[1]);  // Should print `67`
  print(ip[2]);  // Should print `148`
  print(ip[3]);  // Should print `100`

  print(ip.a);  // Should print `192`
  print(ip.b);  // Should print `67`
  print(ip.c);  // Should print `148`
  print(ip.d);

  print(ip.toString());  // Should print `192.67.148.100`

  print(Ip4.classAMask.cidrLen);  // Should print `8`
  print(Ip4.classBMask.cidrLen);  // Should print `16`
  print(Ip4.classCMask.cidrLen);  // Should print `24`

  print(ip.masked(Ip4.classBMask));  // Should print `192.67.0.0`;

  final Ip4Net net = Ip4Net.parseCIDR('192.67.148.100/16');

  print(net.network);  // Should print `192.67.0.0`;
  print(net.mask);  // Should print `255.255.0.0`;

  print(net.toString());  // Should print `192.67.0.0/16`;

  print(net.mask.cidrLen);  // Should print `16`;

  print(net.contains(Ip4.parse('192.67.148.27')));  // Should print `true`;
  print(net.contains(Ip4.parse('192.68.148.27')));  // Should print `false`;
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  jaguar_ipnet: ^0.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:jaguar_ipnet/jaguar_ipnet.dart';
  
Version Uploaded Documentation Archive
0.0.1 Mar 2, 2017 Go to the documentation of jaguar_ipnet 0.0.1 Download jaguar_ipnet 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <2.0.0