dev
dart 30 lines 1.13 KB
Raw
1 import 'package:cake_wallet/core/validator.dart';
2 import 'package:cake_wallet/generated/i18n.dart';
3
4 class NodeAddressValidator extends TextValidator {
5 NodeAddressValidator()
6 : super(
7 errorMessage: S.current.error_text_node_address,
8 pattern:
9 '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$|^[0-9a-zA-Z.\-]+\$');
10 }
11
12 class NodePathValidator extends TextValidator {
13 NodePathValidator()
14 : super(
15 errorMessage: S.current.error_text_node_address,
16 pattern: '^([/0-9a-zA-Z.\-]+)?\$',
17 isAutovalidate: true,
18 );
19 }
20
21 // NodeAddressValidatorDecredBlankException allows decred to send a blank ip
22 // address which effectively clears the current set persistent peer.
23 class NodeAddressValidatorDecredBlankException extends TextValidator {
24 NodeAddressValidatorDecredBlankException()
25 : super(
26 errorMessage: S.current.error_text_node_address,
27 isAutovalidate: true,
28 pattern:
29 '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\$|^[0-9a-zA-Z.\-]+\$');
30 }