diff --git a/termius/core/models/terminal.py b/termius/core/models/terminal.py index eccb234..f09a1bb 100644 --- a/termius/core/models/terminal.py +++ b/termius/core/models/terminal.py @@ -205,15 +205,15 @@ class PFRule(Model): 'remote_port': Field(int, False, 22), } set_name = 'pfrule_set' - crypto_fields = {'label', 'bound_address', 'hostname'} + crypto_fields = {'label', 'hostname'} binding_getter = { - 'L': attrgetter( + 'Local Rule': attrgetter( 'bound_address', 'local_port', 'hostname', 'remote_port' ), - 'D': attrgetter('bound_address', 'local_port'), + 'Dynamic Rule': attrgetter('bound_address', 'local_port'), } - binding_getter['R'] = binding_getter['L'] + binding_getter['Remote Rule'] = binding_getter['Local Rule'] @property def binding(self): diff --git a/termius/handlers/pf_rule.py b/termius/handlers/pf_rule.py index d56963d..e0133bf 100644 --- a/termius/handlers/pf_rule.py +++ b/termius/handlers/pf_rule.py @@ -29,9 +29,9 @@ def fields(self): def binding_parsers(self): """Return binding parser per type abbreviation.""" return { - 'D': BindingParser.dynamic, - 'L': BindingParser.local, - 'R': BindingParser.remote, + 'Dynamic Rule': BindingParser.dynamic, + 'Local Rule': BindingParser.local, + 'Remote Rule': BindingParser.remote, } def extend_parser(self, parser): @@ -42,15 +42,15 @@ def extend_parser(self, parser): ) parser.add_argument( '--dynamic', dest='pf_type', action='store_const', - const='D', help='dynamic port forwarding' + const='Dynamic Rule', help='dynamic port forwarding' ) parser.add_argument( '--remote', dest='pf_type', action='store_const', - const='R', help='remote port forwarding' + const='Remote Rule', help='remote port forwarding' ) parser.add_argument( '--local', dest='pf_type', action='store_const', - const='L', help='local port forwarding' + const='Local Rule', help='local port forwarding' ) parser.add_argument( '--binding', metavar='BINDINGS', diff --git a/tests/integration/pfrule.bats b/tests/integration/pfrule.bats index ffbe874..92cd7a8 100644 --- a/tests/integration/pfrule.bats +++ b/tests/integration/pfrule.bats @@ -22,7 +22,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"L"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Local Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ $(get_model_field 'pfrule_set' $pfrule 'bound_address') = "null" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = '2' ] @@ -36,7 +36,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"R"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Remote Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ $(get_model_field 'pfrule_set' $pfrule 'bound_address') = "null" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2" ] @@ -50,7 +50,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"D"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Dynamic Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ $(get_model_field 'pfrule_set' $pfrule 'bound_address') = "null" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2222" ] @@ -64,7 +64,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"L"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Local Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ $(get_model_field 'pfrule_set' $pfrule 'bound_address') = "\"local\"" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2" ] @@ -78,7 +78,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"R"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Remote Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ $(get_model_field 'pfrule_set' $pfrule 'bound_address') = "\"localhost\"" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2" ] @@ -92,7 +92,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"D"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Dynamic Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ "$(get_model_field 'pfrule_set' $pfrule 'bound_address')" = "\"127.0.0.1\"" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2222" ] @@ -107,7 +107,7 @@ setup() { [ "$status" -eq 0 ] [ $(get_models_set_length 'pfrule_set') -eq 1 ] pfrule=${lines[1]} - [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"L"' ] + [ "$(get_model_field 'pfrule_set' $pfrule 'pf_type')" = '"Local Rule"' ] [ $(get_model_field 'pfrule_set' $pfrule 'host') = $host ] [ "$(get_model_field 'pfrule_set' $pfrule 'bound_address')" = "\"local\"" ] [ $(get_model_field 'pfrule_set' $pfrule 'local_port') = "2" ]