stun_dart 0.1.0+1-dev

  • Readme
  • Changelog
  • Example
  • Installing
  • 49

STUN Dart #

Simple plug and play stun client for dart, with configurable predefined list of public stun.

Usage #

This is a bare minimum stun client useful for further establishing peer-to-peer connection between two different clients.

To Do #

  • [] Simplifying
  • [] Optimizing
  • [] Cleaning
  • [] Documenting
  • [] Adding Support for User Defined STUN client
  • [] Making Code more Isolate friendly
  • [] Adding Support for Authentication

9th Dec, 2019 #

Sorry, but the development for this project is currently halted due to my lack of time. I will update it if anyone needs further help.

Cheers, Ronit R. BK (ron.ram5126@gmail.com)

0.1.0+1-dev #

  • Simple STUN client useful for knowing client's data

example/main.dart

import "package:stun_dart/stun.dart";

void main() async {
  int _responseCounter = 0;
  initializeStun(callback: (String selfAddress) {
    var response = calculateResponse();
    print(selfAddress);
    print(response.result);
    print(response.natType);
    _responseCounter++;
  });
  while (_responseCounter < 7) {
    await Future.delayed(Duration(seconds: 2));
  }
  await stopStunning();
}

Use this package as a library

1. Depend on it

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


dependencies:
  stun_dart: ^0.1.0+1-dev

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:stun_dart/isolated_stun.dart';
import 'package:stun_dart/public_STUN.dart';
import 'package:stun_dart/stun.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
84
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14

Analysis suggestions

Package not compatible with runtime flutter-web on web

Because:

  • package:stun_dart/isolated_stun.dart that imports:
  • package:stun_dart/stun.dart that imports:
  • package:stun_dart/src/util/models.dart that imports:
  • package:stun_dart/src/message/message.dart that imports:
  • package:stun_dart/src/message/attributes/attributes.dart that imports:
  • package:stun_dart/src/message/attributes/default_attribute.dart that imports:
  • package:stun_dart/src/message/attributes/util/get_serilizable.dart that imports:
  • package:stun_dart/src/message/attributes/mapped_address.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:stun_dart/isolated_stun.dart that imports:
  • package:stun_dart/stun.dart that imports:
  • package:stun_dart/src/util/models.dart that imports:
  • package:stun_dart/src/message/message.dart that imports:
  • package:stun_dart/src/message/attributes/attributes.dart that imports:
  • package:stun_dart/src/message/attributes/default_attribute.dart that imports:
  • package:stun_dart/src/message/attributes/util/get_serilizable.dart that imports:
  • package:stun_dart/src/message/attributes/mapped_address.dart that imports:
  • dart:io

Health issues and suggestions

Document public APIs. (-1 points)

31 out of 31 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/stun.dart. (-4.41 points)

Analysis of lib/stun.dart reported 9 hints, including:

line 23 col 11: Unnecessary new keyword.

line 24 col 37: Unnecessary new keyword.

line 25 col 43: Unnecessary new keyword.

line 28 col 28: Use isEmpty instead of length

line 39 col 7: Use isEmpty instead of length

Fix lib/src/message/message.dart. (-1.99 points)

Analysis of lib/src/message/message.dart reported 4 hints:

line 12 col 14: Unnecessary new keyword.

line 31 col 21: Unnecessary new keyword.

line 63 col 9: Unnecessary new keyword.

line 84 col 12: Unnecessary new keyword.

Fix lib/isolated_stun.dart. (-1.49 points)

Analysis of lib/isolated_stun.dart reported 3 hints:

line 7 col 37: Unnecessary new keyword.

line 15 col 5: DO use curly braces for all flow control structures.

line 61 col 17: Unnecessary new keyword.

Fix additional 11 files with analysis or formatting issues. (-7.98 points)

Additional issues in the following files:

  • lib/src/message/TLV_encoding.dart (3 hints)
  • lib/src/message/attributes/mapped_address.dart (3 hints)
  • lib/src/message/attributes/attributes.dart (2 hints)
  • lib/src/message/attributes/error.dart (2 hints)
  • lib/src/util/magic_cookie.dart (2 hints)
  • lib/src/message/attributes/default_attribute.dart (1 hint)
  • lib/src/message/attributes/username.dart (1 hint)
  • lib/src/message/attributes/util/get_serilizable.dart (1 hint)
  • lib/src/message/attributes/xaddress.dart (1 hint)
  • lib/src/message/attributes/changed_address.dart (Run dartfmt to format lib/src/message/attributes/changed_address.dart.)
  • lib/src/util/exceptions.dart (Run dartfmt to format lib/src/util/exceptions.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2<3.0.0
dart_stringprep ^0.1.0+4-dev 0.1.0+4-dev
uuid ^2.0.4 2.2.0
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
test ^1.3.0