@@ -30,9 +30,11 @@ namespace winrt::YtFlowApp::implementation
30
30
hstring RuleResolver;
31
31
hstring OutboundType;
32
32
std::string CustomRules;
33
+ std::string FakeIpFilter;
33
34
std::vector<NewProfileConfigRuleset> Rulesets{};
34
35
};
35
36
void CreatePresetPlugins (uint32_t profileId, NewProfileConfig config);
37
+ std::vector<std::string_view> SplitLines (std::string_view sv);
36
38
37
39
NewProfilePage::NewProfilePage ()
38
40
{
@@ -90,6 +92,7 @@ namespace winrt::YtFlowApp::implementation
90
92
.RuleResolver = RuleResolverComboBox ().SelectedItem ().as <ComboBoxItem>().Tag ().as <hstring>(),
91
93
.OutboundType = m_selectedOutboundType,
92
94
.CustomRules = to_string (CustomRuleTextBox ().Text ()),
95
+ .FakeIpFilter = to_string (FakeIpFilterTextBox ().Text ()),
93
96
.Rulesets =
94
97
std::views::transform (
95
98
RulesetListView ().Items (),
@@ -314,7 +317,6 @@ namespace winrt::YtFlowApp::implementation
314
317
void CreatePresetPlugins (uint32_t profileId, NewProfileConfig config)
315
318
{
316
319
using namespace std ::string_literals;
317
- using namespace std ::string_view_literals;
318
320
try
319
321
{
320
322
auto doc = NewProfilePage::GenPresetDoc ();
@@ -407,19 +409,20 @@ namespace winrt::YtFlowApp::implementation
407
409
{" plugin_version" , 0 },
408
410
{" param" ,
409
411
{{" resolver" , ruleResolver},
410
- {" source" ,
411
- {{" format" , " quanx-filter" },
412
- {" text" , std::views::split (std::string_view (config.CustomRules ), " \r " sv) |
413
- std::views::transform ([](auto const sr) {
414
- std::string_view const sv (sr);
415
- auto const rpos = sv.find_last_not_of (' \r ' );
416
- return sv.substr (0 , rpos == std::string_view::npos ? sv.size () : rpos + 1 );
417
- }) |
418
- std::ranges::to<std::vector>()}}},
412
+ {" source" , {{" format" , " quanx-filter" }, {" text" , SplitLines (config.CustomRules )}}},
419
413
{" actions" , availableActions ()},
420
414
{" rules" , {{" proxy" , " proxy" }, {" direct" , " direct" }, {" reject" , " reject" }, {" next" , " next" }}},
421
- {" fallback" , makeAction (SplitRoutingRuleDecision::Next)}}}};
415
+ {" fallback" , makeAction (SplitRoutingRuleDecision::Next)}}}},
416
+ fakeipFilterDoc{
417
+ {" desc" , " Generate real IP addresses instead of Fake IPs for specified domain names." },
418
+ {" plugin" , " list-dispatcher" },
419
+ {" plugin_version" , 0 },
420
+ {" param" ,
421
+ {{" source" , {{" format" , " surge-domain-set" }, {" text" , SplitLines (config.FakeIpFilter )}}},
422
+ {" action" , {{" resolver" , " phy.resolver" }}},
423
+ {" fallback" , {{" resolver" , " fake-ip.resolver" }}}}}};
422
424
doc[" custom-rule-dispatcher" ] = std::move (customRuleDoc);
425
+ doc[" fakeip-filter" ] = std::move (fakeipFilterDoc);
423
426
424
427
// Adjust outbound
425
428
if (config.OutboundType == L" ss" )
@@ -542,4 +545,15 @@ namespace winrt::YtFlowApp::implementation
542
545
L" ip6-cidr, 2001:4860:4860::8800/120, proxy, no-resolve\r\n " );
543
546
CustomRuleTextBox ().Visibility (Visibility::Visible);
544
547
}
548
+
549
+ std::vector<std::string_view> SplitLines (std::string_view sv)
550
+ {
551
+ using namespace std ::string_view_literals;
552
+ return std::views::split (std::string_view (sv), " \r " sv) | std::views::transform ([](auto const sr) {
553
+ std::string_view const sv (sr);
554
+ auto const rpos = sv.find_last_not_of (' \r ' );
555
+ return sv.substr (0 , rpos == std::string_view::npos ? sv.size () : rpos + 1 );
556
+ }) |
557
+ std::ranges::to<std::vector>();
558
+ }
545
559
}
0 commit comments