Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
cda0d64
Add a mDNS package
sgjesse Oct 28, 2015
5242a77
Fix warning and hint int test
sgjesse Oct 28, 2015
8394100
Correct two typos.
karlklose Oct 29, 2015
3147614
Extend the mDNS package with a native extension used on Mac OS
sgjesse Nov 2, 2015
1aecdd0
Revert "Extend the mDNS package with a native extension used on Mac OS"
sgjesse Nov 2, 2015
b753a49
Re-land "Extend the mDNS package with a native extension used on Mac OS"
sgjesse Nov 3, 2015
bd21b36
Improve resource record implementation in the mdns package.
karlklose Nov 6, 2015
5eae734
Minor fixes to the mDNS package
sgjesse Nov 10, 2015
be10902
Update the mDNS command line tools in the mdns package
sgjesse Nov 10, 2015
67e73fc
Update the mDNS native extension for Mac OS to handle PTR and SRV rec…
sgjesse Nov 10, 2015
51c2879
Add multiple results and timeout handling to the Mac OS mDNS native e…
sgjesse Nov 10, 2015
8ba84d1
Add mDNS discovery to the Fletch compiler
sgjesse Nov 10, 2015
2b2fe61
Avoid a warning due to bug in Dart SDK
sgjesse Nov 10, 2015
afd0ffa
Update project authors statements to Dartino
mit-mit Jan 28, 2016
27e32bb
Rename fletch -> dartino
ricowind Feb 3, 2016
a02b198
Update Dart binaries to 1.18.0-dev.4.4
karlklose Jul 28, 2016
372e481
Move the serial_port native code
sgjesse Aug 3, 2016
13440cc
Initial refactor/adding of mdns
dnfield Oct 18, 2018
a062a28
Initial refactor/adding of mdns
dnfield Oct 18, 2018
0a158b2
move helper methods to tool/
dnfield Oct 18, 2018
cf98f1f
update docs, add example
dnfield Oct 18, 2018
2d8f0ab
merge
dnfield Oct 18, 2018
f962358
remove RRType.any - not ready
dnfield Oct 18, 2018
a223011
README
dnfield Oct 18, 2018
1ae7747
remove lint ignore, update CI
dnfield Oct 18, 2018
8a711b9
update CI for non-flutter packages
dnfield Oct 18, 2018
60f3635
update regex
dnfield Oct 18, 2018
a935aee
revert incremental_build.sh
dnfield Oct 18, 2018
4aba212
Update docs, expose multicast parameter
dnfield Oct 19, 2018
cefc13b
fix tests, run analyze first
dnfield Oct 19, 2018
dcf69e4
Fix readme for mDNS
dnfield Oct 19, 2018
2c09d26
move bin to example, remove args from main pubspec
dnfield Oct 20, 2018
d0071bd
Update example
dnfield Oct 20, 2018
af7a0df
Remove collection dep
dnfield Oct 20, 2018
14826cb
Fix unintentional change to Palette, avoid abbreviations, real hash c…
dnfield Oct 22, 2018
f3a79a8
vertical alignment
dnfield Oct 22, 2018
b9572ba
dartfmt and remove all references to args package
dnfield Oct 23, 2018
9dbb4dd
cleanup
dnfield Oct 24, 2018
5bcabe2
typo, word wrap
dnfield Oct 24, 2018
1961d9f
Add type parameters
dnfield Oct 24, 2018
0eb9bc1
Update examples to use type parameters
dnfield Oct 25, 2018
d379223
minor fixes
dnfield Nov 2, 2018
8d3c4e2
Merge remote-tracking branch 'upstream/master'
dnfield Nov 7, 2018
64902f4
remvoe debugging cde
dnfield Nov 7, 2018
b8251d9
move dumpDatagram to tools
dnfield Nov 7, 2018
2ad7aea
format
dnfield Nov 7, 2018
09b47d2
Set socket options
dnfield Jan 17, 2019
0962e7d
bump
dnfield Jan 19, 2019
3d2f2a4
update version constraint, fix analyzer issues
dnfield Jan 19, 2019
4a0974d
Merge remote-tracking branch 'upstream/master'
dnfield Jan 23, 2019
de88b93
Fix cache, var names, comments
dnfield Jan 24, 2019
3602baa
one missed comment
dnfield Jan 24, 2019
bceebbd
missed renames
dnfield Jan 24, 2019
b5b1d4e
formatting
dnfield Jan 24, 2019
554ac6f
missing comment
dnfield Jan 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dartfmt and remove all references to args package
  • Loading branch information
dnfield committed Oct 23, 2018
commit b9572ba3d9cac9a1e65bdd340c5095ebf7704422
3 changes: 2 additions & 1 deletion packages/multicast_dns/example/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ void main() async {
await client.start();

// Get the PTR recod for the service.
await for (PtrResourceRecord ptr in client.lookup(ResourceRecordType.ptr, name)) {
await for (PtrResourceRecord ptr
in client.lookup(ResourceRecordType.ptr, name)) {
// Use the domainName from the PTR record to get the SRV record,
// which will have the port and local hostname.
// Note that duplicate messages may come through, especially if any
Expand Down
18 changes: 5 additions & 13 deletions packages/multicast_dns/example/mdns-resolve.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,29 @@
// Example script to illustrate how to use the mdns package to lookup names
// on the local network.

import 'package:args/args.dart';

import 'package:multicast_dns/mdns_client.dart';

void main(List<String> args) async {
// Parse the command line arguments.
final ArgParser parser = ArgParser();
parser.addOption('timeout', abbr: 't', defaultsTo: '5');
final ArgResults arguments = parser.parse(args);

if (arguments.rest.length != 1) {
if (args.length != 1) {
print('''
Please provide an address as argument.

For example:
dart mdns-resolve.dart [--timeout <timeout>] dartino.local''');
dart mdns-resolve.dart dartino.local''');
return;
}

final String name = arguments.rest[0];
final String name = args[0];

final MDnsClient client = MDnsClient();
await client.start();
final Duration timeout = Duration(seconds: int.parse(arguments['timeout']));
await for (IPAddressResourceRecord record
in client.lookup(ResourceRecordType.a, name, timeout: timeout)) {
in client.lookup(ResourceRecordType.a, name)) {
print('Found address (${record.address}).');
}

await for (IPAddressResourceRecord record
in client.lookup(ResourceRecordType.aaaa, name, timeout: timeout)) {
in client.lookup(ResourceRecordType.aaaa, name)) {
print('Found address (${record.address}).');
}
client.stop();
Expand Down
23 changes: 9 additions & 14 deletions packages/multicast_dns/example/mdns-sd.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,25 @@
// Example script to illustrate how to use the mdns package to discover services
// on the local network.

import 'package:args/args.dart';

import 'package:multicast_dns/mdns_client.dart';

void main(List<String> args) async {
// Parse the command line arguments.
final ArgParser parser = ArgParser();
parser.addOption('timeout', abbr: 't', defaultsTo: '5');
parser.addFlag('verbose', abbr: 'v', defaultsTo: false);
final ArgResults arguments = parser.parse(args);

if (arguments.rest.length != 1) {
if (args.isEmpty) {
print('''
Please provide the name of a service as argument.

For example:
dart mdns-sd.dart [--timeout <timeout>] [--verbose] _workstation._tcp.local''');
dart mdns-sd.dart [--verbose] _workstation._tcp.local''');
return;
}

final bool verbose = arguments['verbose'];
final String name = arguments.rest[0];
final bool verbose = args.contains('--verbose') || args.contains('-v');
final String name = args.last;
final MDnsClient client = MDnsClient();
await client.start();

await for (PtrResourceRecord ptr in client.lookup(ResourceRecordType.ptr, name)) {
await for (PtrResourceRecord ptr
in client.lookup(ResourceRecordType.ptr, name)) {
if (verbose) {
print(ptr);
}
Expand All @@ -40,7 +33,9 @@ For example:
print(srv);
}
if (verbose) {
await client.lookup(ResourceRecordType.txt, ptr.domainName).forEach(print);
await client
.lookup(ResourceRecordType.txt, ptr.domainName)
.forEach(print);
}
await for (IPAddressResourceRecord ip
in client.lookup(ResourceRecordType.a, srv.target)) {
Expand Down
14 changes: 0 additions & 14 deletions packages/multicast_dns/example/pubspec.yaml

This file was deleted.

12 changes: 6 additions & 6 deletions packages/multicast_dns/lib/src/resource_record.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class ResourceRecordType {
/// Asserts that a given int is a valid ResourceRecordtype.
static void debugAssertValid(int resourceRecordType) {
assert(resourceRecordType == a ||
resourceRecordType == aaaa ||
resourceRecordType == ptr ||
resourceRecordType == srv ||
resourceRecordType == txt);
resourceRecordType == aaaa ||
resourceRecordType == ptr ||
resourceRecordType == srv ||
resourceRecordType == txt);
}
}

Expand Down Expand Up @@ -86,8 +86,8 @@ abstract class ResourceRecord {
@protected
bool _equals(ResourceRecord other) {
return other.name == name &&
other.validUntil == validUntil &&
other.rrValue == rrValue;
other.validUntil == validUntil &&
other.rrValue == rrValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

trivial nit: indentation should lead to the expressions being vertically aligned for easier reading

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the format check which uses dartfmt. /cc @gspencergoog

We either have to turn off the Dartfmt check, or we have to allow this to not be indented this way.

}

@override
Expand Down
20 changes: 10 additions & 10 deletions packages/multicast_dns/test/lookup_resolver_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void testResult() {
test('One pending request and one response', () async {
final Duration noTimeout = Duration(days: 1);
final LookupResolver resolver = LookupResolver();
final Stream<ResourceRecord> futureResult =
resolver.addPendingRequest(ResourceRecordType.a, 'xxx.local', noTimeout);
final Stream<ResourceRecord> futureResult = resolver.addPendingRequest(
ResourceRecordType.a, 'xxx.local', noTimeout);
final ResourceRecord response =
ip4Result('xxx.local', InternetAddress('1.2.3.4'));
resolver.handleResponse(<ResourceRecord>[response]);
Expand All @@ -50,10 +50,10 @@ void testResult2() {
test('Two requests', () async {
final Duration noTimeout = Duration(days: 1);
final LookupResolver resolver = LookupResolver();
final Stream<ResourceRecord> futureResult1 =
resolver.addPendingRequest(ResourceRecordType.a, 'xxx.local', noTimeout);
final Stream<ResourceRecord> futureResult2 =
resolver.addPendingRequest(ResourceRecordType.a, 'yyy.local', noTimeout);
final Stream<ResourceRecord> futureResult1 = resolver.addPendingRequest(
ResourceRecordType.a, 'xxx.local', noTimeout);
final Stream<ResourceRecord> futureResult2 = resolver.addPendingRequest(
ResourceRecordType.a, 'yyy.local', noTimeout);
final ResourceRecord response1 =
ip4Result('xxx.local', InternetAddress('1.2.3.4'));
final ResourceRecord response2 =
Expand All @@ -74,11 +74,11 @@ void testResult3() {
final ResourceRecord response0 =
ip4Result('zzz.local', InternetAddress('2.3.4.5'));
resolver.handleResponse(<ResourceRecord>[response0]);
final Stream<ResourceRecord> futureResult1 =
resolver.addPendingRequest(ResourceRecordType.a, 'xxx.local', noTimeout);
final Stream<ResourceRecord> futureResult1 = resolver.addPendingRequest(
ResourceRecordType.a, 'xxx.local', noTimeout);
resolver.handleResponse(<ResourceRecord>[response0]);
final Stream<ResourceRecord> futureResult2 =
resolver.addPendingRequest(ResourceRecordType.a, 'yyy.local', noTimeout);
final Stream<ResourceRecord> futureResult2 = resolver.addPendingRequest(
ResourceRecordType.a, 'yyy.local', noTimeout);
resolver.handleResponse(<ResourceRecord>[response0]);
final ResourceRecord response1 =
ip4Result('xxx.local', InternetAddress('1.2.3.4'));
Expand Down