V0.1.7 (#5)
* save url when connected and allow toggling connection on app start (#2) * mask ip in logs, reduce keep-alive logs frequency * update comment about debug link, migrate prefs to ktx * auto-connect for telemost * fix ice ipv6 resolving * auto-connect for vk * refactor hooks names * regenerate android resources * remove stale telemost dc * kick disconnected user from vk, refactor relay on mobile client, prevent double hook injection * refactor constants * set low importance for notification to avoid signals * stop vpn/relay at app destroy, reset state at vpn disconnect * prevent vk session close at video tunnel * kick disconnected user from vk, refactor relay on mobile client, prevent double hook injection * multiple tabs/calls, write android logs in file * update ux, fix fd lifecycle in tun2socks * increment release version --------- Co-authored-by: HukuToc2288 <hukutoc2288@yandex.ru> Co-authored-by: kulikov <user@Mac.lan>
This commit is contained in:
1 parent
e8da07179a
commit
84da73c324
52 files changed
+1510
-479
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package mobile
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
// maskAddr masks the sensitive portion of an address for logging.
|
||||
// IPv4: keeps first two octets, e.g. "192.168.x.x"
|
||||
// IPv6: fully masked
|
||||
// hostname: first char + "***"
|
||||
// host:port: masks host, keeps port
|
||||
func maskAddr(addr string) string {
|
||||
host, port, err := net.SplitHostPort(addr)
|
||||
if err != nil {
|
||||
host = addr
|
||||
port = ""
|
||||
}
|
||||
masked := maskHost(host)
|
||||
if port != "" {
|
||||
return net.JoinHostPort(masked, port)
|
||||
}
|
||||
return masked
|
||||
}
|
||||
|
||||
func maskHost(host string) string {
|
||||
if host == "" {
|
||||
return ""
|
||||
}
|
||||
ip := net.ParseIP(host)
|
||||
if ip != nil {
|
||||
if ip4 := ip.To4(); ip4 != nil {
|
||||
return fmt.Sprintf("%d.%d.x.x", ip4[0], ip4[1])
|
||||
}
|
||||
return "x::x"
|
||||
}
|
||||
if len(host) <= 1 {
|
||||
return "*"
|
||||
}
|
||||
return string(host[0]) + "***"
|
||||
}
|
||||
Reference in new issue
Block a user