-
Notifications
You must be signed in to change notification settings - Fork 425
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from cloudwebrtc/golang
For golang server.
- Loading branch information
Showing
10 changed files
with
101 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'dart:convert'; | ||
import 'dart:async'; | ||
import 'dart:io'; | ||
|
||
Future<Map> getTurnCredential(String host, int port) async { | ||
HttpClient client = HttpClient(context: SecurityContext()); | ||
client.badCertificateCallback = | ||
(X509Certificate cert, String host, int port) { | ||
print('getTurnCredential: Allow self-signed certificate => $host:$port. '); | ||
return true; | ||
}; | ||
var url = 'https://$host:$port/api/turn?service=turn&username=flutter-webrtc'; | ||
var request = await client.getUrl(Uri.parse(url)); | ||
var response = await request.close(); | ||
var responseBody = await response.transform(Utf8Decoder()).join(); | ||
print('getTurnCredential:response => $responseBody.'); | ||
Map data = JsonDecoder().convert(responseBody); | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'dart:convert'; | ||
import 'package:http/http.dart' as http; | ||
|
||
Future<Map> getTurnCredential(String host, int port) async { | ||
var url = 'https://$host:$port/api/turn?service=turn&username=flutter-webrtc'; | ||
final res = await http.get(url); | ||
if (res.statusCode == 200) { | ||
var data = json.decode(res.body); | ||
print('getTurnCredential:response => $data.'); | ||
return data; | ||
} | ||
return {}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters