mirror of https://github.com/oxen-io/lokinet
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)/../"
|
||||
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
|
||||
fi
|
||||
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
|
||||
|
||||
swift_format=$(command -v swiftformat 2>/dev/null)
|
||||
if [ $? -eq 0 ]; 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
|
||||
exit 3
|
||||
fi
|
||||
done
|
||||
else
|
||||
$swift_format --quiet $(find daemon | grep -E '\.swift$' | grep -v '\#')
|
||||
$swift_format --quiet $(find daemon | grep -E '\.swift$' | grep -v '#')
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -38,14 +38,16 @@ namespace llarp::apple
|
|||
trampoline_active = enable;
|
||||
}
|
||||
|
||||
void RouteManager::AddDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||
void
|
||||
RouteManager::AddDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||
{
|
||||
check_trampoline(true);
|
||||
if (callback_context and route_callbacks.add_default_route)
|
||||
route_callbacks.add_default_route(callback_context);
|
||||
}
|
||||
|
||||
void RouteManager::DelDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||
void
|
||||
RouteManager::DelDefaultRouteViaInterface(vpn::NetworkInterface&)
|
||||
{
|
||||
check_trampoline(false);
|
||||
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
|
||||
/// because the appex isn't subject to its own rules.
|
||||
void
|
||||
AddRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||
void AddRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||
{}
|
||||
|
||||
void
|
||||
DelRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||
void DelRoute(net::ipaddr_t /*ip*/, net::ipaddr_t /*gateway*/) override
|
||||
{}
|
||||
|
||||
void
|
||||
|
|
|
@ -213,9 +213,9 @@ namespace llarp::dns
|
|||
{
|
||||
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
|
||||
// address" when unbound tries to connect to the localhost address using a source address
|
||||
// of 0.0.0.0. Yay apple.
|
||||
// macOS is stupid: the default (0.0.0.0) fails with "send failed: Can't assign
|
||||
// requested address" when unbound tries to connect to the localhost address using a
|
||||
// source address of 0.0.0.0. Yay apple.
|
||||
SetOpt("outgoing-interface:", "127.0.0.1");
|
||||
|
||||
// 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())
|
||||
{
|
||||
m_Poller = loop_ptr->resource<uvw::PollHandle>(ub_fd(m_ctx));
|
||||
m_Poller->on<uvw::PollEvent>([this](auto&, auto&) {
|
||||
ub_process(m_ctx);
|
||||
});
|
||||
m_Poller->on<uvw::PollEvent>([this](auto&, auto&) { ub_process(m_ctx); });
|
||||
m_Poller->start(uvw::PollHandle::Event::READABLE);
|
||||
return;
|
||||
}
|
||||
|
@ -408,7 +406,8 @@ namespace llarp::dns
|
|||
if (m_Poller)
|
||||
m_Poller->close();
|
||||
#endif
|
||||
if (m_ctx) {
|
||||
if (m_ctx)
|
||||
{
|
||||
::ub_ctx_delete(m_ctx);
|
||||
m_ctx = nullptr;
|
||||
}
|
||||
|
|
|
@ -177,13 +177,14 @@ namespace llarp::dns
|
|||
/// reset the resolver state, optionally replace upstream info with new info. The default base
|
||||
/// implementation does nothing.
|
||||
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.
|
||||
virtual void
|
||||
Down(){}
|
||||
Down()
|
||||
{}
|
||||
|
||||
/// attempt to handle a dns message
|
||||
/// returns true if we consumed this query and it should not be processed again
|
||||
|
|
|
@ -902,7 +902,8 @@ namespace llarp
|
|||
return true;
|
||||
}
|
||||
|
||||
void TunEndpoint::ResetInternalState()
|
||||
void
|
||||
TunEndpoint::ResetInternalState()
|
||||
{
|
||||
service::Endpoint::ResetInternalState();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue