mirror of
https://github.com/oxen-io/lokinet
synced 2023-12-14 06:53:00 +01:00
Format fixes & fix warning in format script
- Don't escape '#' in the greps in format.sh: they warn about a spurious `\` in the latest grep. - reformat
This commit is contained in:
parent
ec91a6db05
commit
93c01623b0
|
@ -21,23 +21,23 @@ fi
|
||||||
|
|
||||||
cd "$(dirname $0)/../"
|
cd "$(dirname $0)/../"
|
||||||
if [ "$1" = "verify" ] ; then
|
if [ "$1" = "verify" ] ; then
|
||||||
if [ $($binary --output-replacements-xml $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|m(m)?)$' | grep -v '\#') | grep '</replacement>' | wc -l) -ne 0 ] ; then
|
if [ $($binary --output-replacements-xml $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|m(m)?)$' | grep -v '#') | grep '</replacement>' | wc -l) -ne 0 ] ; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
$binary -i $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|m(m)?)$' | grep -v '\#') &> /dev/null
|
$binary -i $(find jni daemon llarp include pybind | grep -E '\.([hc](pp)?|m(m)?)$' | grep -v '#') &> /dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
swift_format=$(command -v swiftformat 2>/dev/null)
|
swift_format=$(command -v swiftformat 2>/dev/null)
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
if [ "$1" = "verify" ] ; then
|
if [ "$1" = "verify" ] ; then
|
||||||
for f in $(find daemon | grep -E '\.swift$' | grep -v '\#') ; do
|
for f in $(find daemon | grep -E '\.swift$' | grep -v '#') ; do
|
||||||
if [ $($swift_format --quiet --dryrun < "$f" | diff "$f" - | wc -l) -ne 0 ] ; then
|
if [ $($swift_format --quiet --dryrun < "$f" | diff "$f" - | wc -l) -ne 0 ] ; then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
$swift_format --quiet $(find daemon | grep -E '\.swift$' | grep -v '\#')
|
$swift_format --quiet $(find daemon | grep -E '\.swift$' | grep -v '#')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -38,14 +38,16 @@ namespace llarp::apple
|
||||||
trampoline_active = enable;
|
trampoline_active = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteManager::AddDefaultRouteViaInterface(vpn::NetworkInterface&)
|
void
|
||||||
|
RouteManager::AddDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||||
{
|
{
|
||||||
check_trampoline(true);
|
check_trampoline(true);
|
||||||
if (callback_context and route_callbacks.add_default_route)
|
if (callback_context and route_callbacks.add_default_route)
|
||||||
route_callbacks.add_default_route(callback_context);
|
route_callbacks.add_default_route(callback_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteManager::DelDefaultRouteViaInterface(vpn::NetworkInterface&)
|
void
|
||||||
|
RouteManager::DelDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||||
{
|
{
|
||||||
check_trampoline(false);
|
check_trampoline(false);
|
||||||
if (callback_context and route_callbacks.del_default_route)
|
if (callback_context and route_callbacks.del_default_route)
|
||||||
|
|
|
@ -15,12 +15,10 @@ namespace llarp::apple
|
||||||
|
|
||||||
/// These are called for poking route holes, but we don't have to do that at all on macos
|
/// These are called for poking route holes, but we don't have to do that at all on macos
|
||||||
/// because the appex isn't subject to its own rules.
|
/// because the appex isn't subject to its own rules.
|
||||||
void
|
void AddRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||||
AddRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void DelRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||||
DelRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -213,9 +213,9 @@ namespace llarp::dns
|
||||||
{
|
{
|
||||||
if (dns.hostString() == "127.0.0.1" and dns.getPort() == apple::dns_trampoline_port)
|
if (dns.hostString() == "127.0.0.1" and dns.getPort() == apple::dns_trampoline_port)
|
||||||
{
|
{
|
||||||
// macOS is stupid: the default (0.0.0.0) fails with "send failed: Can't assign requested
|
// macOS is stupid: the default (0.0.0.0) fails with "send failed: Can't assign
|
||||||
// address" when unbound tries to connect to the localhost address using a source address
|
// requested address" when unbound tries to connect to the localhost address using a
|
||||||
// of 0.0.0.0. Yay apple.
|
// source address of 0.0.0.0. Yay apple.
|
||||||
SetOpt("outgoing-interface:", "127.0.0.1");
|
SetOpt("outgoing-interface:", "127.0.0.1");
|
||||||
|
|
||||||
// The trampoline expects just a single source port (and sends everything back to it).
|
// The trampoline expects just a single source port (and sends everything back to it).
|
||||||
|
@ -387,9 +387,7 @@ namespace llarp::dns
|
||||||
if (auto loop_ptr = loop->MaybeGetUVWLoop())
|
if (auto loop_ptr = loop->MaybeGetUVWLoop())
|
||||||
{
|
{
|
||||||
m_Poller = loop_ptr->resource<uvw::PollHandle>(ub_fd(m_ctx));
|
m_Poller = loop_ptr->resource<uvw::PollHandle>(ub_fd(m_ctx));
|
||||||
m_Poller->on<uvw::PollEvent>([this](auto&, auto&) {
|
m_Poller->on<uvw::PollEvent>([this](auto&, auto&) { ub_process(m_ctx); });
|
||||||
ub_process(m_ctx);
|
|
||||||
});
|
|
||||||
m_Poller->start(uvw::PollHandle::Event::READABLE);
|
m_Poller->start(uvw::PollHandle::Event::READABLE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +406,8 @@ namespace llarp::dns
|
||||||
if (m_Poller)
|
if (m_Poller)
|
||||||
m_Poller->close();
|
m_Poller->close();
|
||||||
#endif
|
#endif
|
||||||
if (m_ctx) {
|
if (m_ctx)
|
||||||
|
{
|
||||||
::ub_ctx_delete(m_ctx);
|
::ub_ctx_delete(m_ctx);
|
||||||
m_ctx = nullptr;
|
m_ctx = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,13 +177,14 @@ namespace llarp::dns
|
||||||
/// reset the resolver state, optionally replace upstream info with new info. The default base
|
/// reset the resolver state, optionally replace upstream info with new info. The default base
|
||||||
/// implementation does nothing.
|
/// implementation does nothing.
|
||||||
virtual void
|
virtual void
|
||||||
ResetResolver([[maybe_unused]] std::optional<std::vector<SockAddr>> replace_upstream = std::nullopt)
|
ResetResolver(
|
||||||
{
|
[[maybe_unused]] std::optional<std::vector<SockAddr>> replace_upstream = std::nullopt)
|
||||||
}
|
{}
|
||||||
|
|
||||||
/// cancel all pending requests and cease further operation. Default operation is a no-op.
|
/// cancel all pending requests and cease further operation. Default operation is a no-op.
|
||||||
virtual void
|
virtual void
|
||||||
Down(){}
|
Down()
|
||||||
|
{}
|
||||||
|
|
||||||
/// attempt to handle a dns message
|
/// attempt to handle a dns message
|
||||||
/// returns true if we consumed this query and it should not be processed again
|
/// returns true if we consumed this query and it should not be processed again
|
||||||
|
|
|
@ -902,7 +902,8 @@ namespace llarp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TunEndpoint::ResetInternalState()
|
void
|
||||||
|
TunEndpoint::ResetInternalState()
|
||||||
{
|
{
|
||||||
service::Endpoint::ResetInternalState();
|
service::Endpoint::ResetInternalState();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue