MCPcopy Create free account
hub / github.com/ElementsProject/elements / TryParse

Method TryParse

src/net_permissions.cpp:84–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84bool NetWhitebindPermissions::TryParse(const std::string& str, NetWhitebindPermissions& output, bilingual_str& error)
85{
86 NetPermissionFlags flags;
87 size_t offset;
88 if (!TryParsePermissionFlags(str, flags, offset, error)) return false;
89
90 const std::string strBind = str.substr(offset);
91 CService addrBind;
92 if (!Lookup(strBind, addrBind, 0, false)) {
93 error = ResolveErrMsg("whitebind", strBind);
94 return false;
95 }
96 if (addrBind.GetPort() == 0) {
97 error = strprintf(_("Need to specify a port with -whitebind: '%s'"), strBind);
98 return false;
99 }
100
101 output.m_flags = flags;
102 output.m_service = addrBind;
103 error = Untranslated("");
104 return true;
105}
106
107bool NetWhitelistPermissions::TryParse(const std::string& str, NetWhitelistPermissions& output, bilingual_str& error)
108{

Callers

nothing calls this directly

Calls 8

TryParsePermissionFlagsFunction · 0.85
LookupFunction · 0.85
ResolveErrMsgFunction · 0.85
_Function · 0.85
UntranslatedFunction · 0.85
LookupSubNetFunction · 0.85
GetPortMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected