Compare commits
	
		
			No commits in common. "988db718a2269df6a5779fb093586fdebc9c74cf" and "2f089535a3193334f8a01ea84ed848df2e20f9d9" have entirely different histories.
		
	
	
		
			988db718a2
			...
			2f089535a3
		
	
		
| @ -18,10 +18,6 @@ if a DNS implementation is given, and supports StartTLS. | ||||
| To begin, use [melos](https://github.com/invertase/melos) to bootstrap the project: `melos bootstrap`. Then, the example | ||||
| can be run with `flutter run` on Linux or Android. | ||||
| 
 | ||||
| To run the example, make sure that Flutter is correctly set up and working. If you use | ||||
| the development shell provided by the NixOS Flake, ensure that `ANDROID_HOME` and | ||||
| `ANDROID_AVD_HOME` are pointing to the correct directories. | ||||
| 
 | ||||
| ## License | ||||
| 
 | ||||
| See `./LICENSE`. | ||||
|  | ||||
| @ -12,4 +12,3 @@ analyzer: | ||||
|     - "**/*.g.dart" | ||||
|     - "**/*.freezed.dart" | ||||
|     - "test/" | ||||
|     - "integration_test/" | ||||
|  | ||||
| @ -16,10 +16,10 @@ dependencies: | ||||
|     version: 0.1.4+1 | ||||
|   moxxmpp: | ||||
|     hosted: https://git.polynom.me/api/packages/Moxxy/pub | ||||
|     version: 0.1.2+1 | ||||
|     version: 0.1.1 | ||||
|   moxxmpp_socket_tcp: | ||||
|     hosted: https://git.polynom.me/api/packages/Moxxy/pub | ||||
|     version: 0.1.2+1 | ||||
|     version: 0.1.1 | ||||
| 
 | ||||
| dev_dependencies: | ||||
|   flutter_test: | ||||
|  | ||||
| @ -58,7 +58,9 @@ | ||||
|       CPATH = "${pkgs.xorg.libX11.dev}/include:${pkgs.xorg.xorgproto}/include"; | ||||
|       LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ atk cairo epoxy gdk-pixbuf glib gtk3 harfbuzz pango ]; | ||||
| 
 | ||||
|       ANDROID_HOME = (toString ./.) + "/.android/sdk"; | ||||
|       JAVA_HOME = pinnedJDK; | ||||
|       ANDROID_AVD_HOME = (toString ./.) + "/.android/avd"; | ||||
|     }; | ||||
|   }); | ||||
| } | ||||
|  | ||||
| @ -1,11 +1,3 @@ | ||||
| ## 0.1.2+1 | ||||
| 
 | ||||
|  - **FIX**: A certificate rejection does not crash the connection. | ||||
| 
 | ||||
| ## 0.1.2 | ||||
| 
 | ||||
|  - **FEAT**: Remove Moxxy specific strings. | ||||
| 
 | ||||
| ## 0.1.1 | ||||
| 
 | ||||
|  - **REFACTOR**: Move packages into packages/. | ||||
|  | ||||
| @ -796,15 +796,6 @@ class XmppConnection { | ||||
| 
 | ||||
|       _updateRoutingState(RoutingState.handleStanzas); | ||||
|       await _onNegotiationsDone(); | ||||
|     } else if (_currentNegotiator!.state == NegotiatorState.error) { | ||||
|       _log.severe('Negotiator returned an error'); | ||||
| 
 | ||||
|       _updateRoutingState(RoutingState.error); | ||||
|       await _setConnectionState(XmppConnectionState.error); | ||||
|       _connectionCompleter?.complete(const XmppConnectionResult(false)); | ||||
|       _connectionCompleter = null; | ||||
| 
 | ||||
|       _closeSocket(); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| name: moxxmpp | ||||
| description: A pure-Dart XMPP library | ||||
| version: 0.1.2+1 | ||||
| version: 0.1.1 | ||||
| homepage: https://codeberg.org/moxxy/moxxmpp | ||||
| publish_to: https://git.polynom.me/api/packages/Moxxy/pub | ||||
| 
 | ||||
|  | ||||
| @ -1,11 +1,3 @@ | ||||
| ## 0.1.2+1 | ||||
| 
 | ||||
|  - **FIX**: A certificate rejection does not crash the connection. | ||||
| 
 | ||||
| ## 0.1.2 | ||||
| 
 | ||||
|  - **FEAT**: Make onBadCertificate available. | ||||
| 
 | ||||
| ## 0.1.1 | ||||
| 
 | ||||
|  - **REFACTOR**: Move packages into packages/. | ||||
|  | ||||
| @ -1,64 +0,0 @@ | ||||
| import 'package:logging/logging.dart'; | ||||
| import 'package:moxxmpp/moxxmpp.dart'; | ||||
| import 'package:moxxmpp_socket_tcp/moxxmpp_socket_tcp.dart'; | ||||
| import 'package:test/test.dart'; | ||||
| 
 | ||||
| Future<void> _runTest(String domain) async { | ||||
|   var gotTLSException = false; | ||||
|   final socket = TCPSocketWrapper(false); | ||||
|   final log = Logger('TestLogger'); | ||||
|   socket.getEventStream().listen((event) { | ||||
|     if (event is XmppSocketTLSFailedEvent) { | ||||
|       log.info('Got XmppSocketTLSFailedEvent from socket'); | ||||
|       gotTLSException = true; | ||||
|     } | ||||
|   }); | ||||
| 
 | ||||
|   final connection = XmppConnection( | ||||
|     ExponentialBackoffReconnectionPolicy(), | ||||
|     socket, | ||||
|   ); | ||||
|   connection.registerFeatureNegotiators([ | ||||
|     StartTlsNegotiator(), | ||||
|   ]); | ||||
|   connection.registerManagers([ | ||||
|     DiscoManager(), | ||||
|     RosterManager(), | ||||
|     PingManager(), | ||||
|     MessageManager(), | ||||
|     PresenceManager('http://moxxmpp.example'), | ||||
|   ]); | ||||
| 
 | ||||
|   connection.setConnectionSettings( | ||||
|     ConnectionSettings( | ||||
|       jid: JID.fromString('testuser@$domain'), | ||||
|       password: 'abc123', | ||||
|       useDirectTLS: true, | ||||
|       allowPlainAuth: true, | ||||
|     ), | ||||
|   ); | ||||
| 
 | ||||
|   final result = await connection.connectAwaitable(); | ||||
|   expect(result.success, false); | ||||
|   expect(gotTLSException, true); | ||||
| } | ||||
| 
 | ||||
| void main() { | ||||
|   Logger.root.level = Level.ALL; | ||||
|   Logger.root.onRecord.listen((record) { | ||||
|     print('${record.level.name}: ${record.time}: ${record.message}'); | ||||
|   }); | ||||
| 
 | ||||
|   for (final domain in [ | ||||
|     'self-signed.badxmpp.eu', | ||||
|     'expired.badxmpp.eu', | ||||
|     'wrong-name.badxmpp.eu', | ||||
|     'missing-chain.badxmpp.eu', | ||||
|     // TODO(Unknown): Technically, this one should not fail | ||||
|     //'ecdsa.badxmpp.eu', | ||||
|   ]) { | ||||
|     test('$domain with connectAwaitable', () async { | ||||
|       await _runTest(domain); | ||||
|     }); | ||||
|   } | ||||
| } | ||||
| @ -1,5 +1,4 @@ | ||||
| library moxxmpp_socket_tcp; | ||||
| 
 | ||||
| export 'src/events.dart'; | ||||
| export 'src/record.dart'; | ||||
| export 'src/socket.dart'; | ||||
|  | ||||
| @ -1,4 +0,0 @@ | ||||
| import 'package:moxxmpp/moxxmpp.dart'; | ||||
| 
 | ||||
| /// Triggered when TLS errors occur | ||||
| class XmppSocketTLSFailedEvent extends XmppSocketEvent {} | ||||
| @ -4,7 +4,6 @@ import 'dart:io'; | ||||
| import 'package:logging/logging.dart'; | ||||
| import 'package:meta/meta.dart'; | ||||
| import 'package:moxxmpp/moxxmpp.dart'; | ||||
| import 'package:moxxmpp_socket_tcp/src/events.dart'; | ||||
| import 'package:moxxmpp_socket_tcp/src/record.dart'; | ||||
| import 'package:moxxmpp_socket_tcp/src/rfc_2782.dart'; | ||||
| 
 | ||||
| @ -67,7 +66,6 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
|       return false; | ||||
|     } | ||||
| 
 | ||||
|     var failedDueToTLS = false; | ||||
|     results.sort(srvRecordSortComparator); | ||||
|     for (final srv in results) { | ||||
|       try { | ||||
| @ -93,20 +91,12 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
|         _secure = true; | ||||
|         _log.finest('Success!'); | ||||
|         return true; | ||||
|       } on Exception catch(e) { | ||||
|       } on SocketException catch(e) { | ||||
|         _log.finest('Failure! $e'); | ||||
|         _ignoreSocketClosure = false; | ||||
| 
 | ||||
|         if (e is HandshakeException) { | ||||
|           failedDueToTLS = true; | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if (failedDueToTLS) { | ||||
|       _eventStream.add(XmppSocketTLSFailedEvent()); | ||||
|     } | ||||
|      | ||||
|     return false; | ||||
|   } | ||||
|    | ||||
| @ -128,7 +118,7 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
|         _ignoreSocketClosure = false; | ||||
|         _log.finest('Success!'); | ||||
|         return true; | ||||
|       } on Exception catch(e) { | ||||
|       } on SocketException catch(e) { | ||||
|         _log.finest('Failure! $e'); | ||||
|         _ignoreSocketClosure = false; | ||||
|         continue; | ||||
| @ -152,7 +142,7 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
|       ); | ||||
|       _log.finest('Success!'); | ||||
|       return true; | ||||
|     } on Exception catch(e) { | ||||
|     } on SocketException catch(e) { | ||||
|       _log.finest('Failure! $e'); | ||||
|       _ignoreSocketClosure = false; | ||||
|       return false; | ||||
| @ -193,14 +183,8 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
|       _ignoreSocketClosure = false; | ||||
|       _setupStreams(); | ||||
|       return true; | ||||
|     } on Exception catch (e) { | ||||
|       _log.severe('Failed to secure socket: $e'); | ||||
|     } on SocketException { | ||||
|       _ignoreSocketClosure = false; | ||||
| 
 | ||||
|       if (e is HandshakeException) { | ||||
|         _eventStream.add(XmppSocketTLSFailedEvent()); | ||||
|       } | ||||
| 
 | ||||
|       return false; | ||||
|     } | ||||
|   } | ||||
| @ -309,7 +293,7 @@ class TCPSocketWrapper extends BaseSocketWrapper { | ||||
| 
 | ||||
|     try { | ||||
|       _socket!.write(data); | ||||
|     } on Exception catch (e) { | ||||
|     } on SocketException catch (e) { | ||||
|       _log.severe(e); | ||||
|       _eventStream.add(XmppSocketErrorEvent(e)); | ||||
|     } | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| name: moxxmpp_socket_tcp | ||||
| description: A socket for moxxmpp using TCP that implements the RFC6120 connection algorithm and XEP-0368 | ||||
| version: 0.1.2+1 | ||||
| version: 0.1.1 | ||||
| homepage: https://codeberg.org/moxxy/moxxmpp | ||||
| publish_to: https://git.polynom.me/api/packages/Moxxy/pub | ||||
| 
 | ||||
| @ -12,7 +12,7 @@ dependencies: | ||||
|   meta: ^1.6.0 | ||||
|   moxxmpp: | ||||
|     hosted: https://git.polynom.me/api/packages/Moxxy/pub | ||||
|     version: ^0.1.2+1 | ||||
|     version: ^0.1.1 | ||||
| 
 | ||||
| dev_dependencies: | ||||
|   lints: ^2.0.0 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user