option to disable beep, adjust server logging
This commit is contained in:
parent
002c30ccd4
commit
61075a5e03
|
@ -1,5 +1,5 @@
|
||||||
.idea
|
.idea
|
||||||
config.yml
|
server/config.yml
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
|
|
|
@ -95,8 +95,11 @@
|
||||||
#define SERVER_PROTOCOL PROTOCOL_UDP
|
#define SERVER_PROTOCOL PROTOCOL_UDP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Custom options from this fork
|
||||||
#define SERVER_ENCRYPTION_ENABLE 1
|
#define SERVER_ENCRYPTION_ENABLE 1
|
||||||
#define CHACHA20_KEY "your encryption key here"
|
#define CHACHA20_KEY "your encryption key here"
|
||||||
|
#define ENABLE_BEEPING 0
|
||||||
|
// End custom options
|
||||||
|
|
||||||
#ifndef CONFIG_MBEDTLS_CHACHAPOLY_C
|
#ifndef CONFIG_MBEDTLS_CHACHAPOLY_C
|
||||||
#define CONFIG_MBEDTLS_CHACHAPOLY_C y
|
#define CONFIG_MBEDTLS_CHACHAPOLY_C y
|
||||||
|
|
|
@ -175,11 +175,13 @@ void printTimeoutStats()
|
||||||
|
|
||||||
void beep(int duration)
|
void beep(int duration)
|
||||||
{
|
{
|
||||||
|
#if ENABLE_BEEPING
|
||||||
// turn on buzzer at 2000Hz frequency
|
// turn on buzzer at 2000Hz frequency
|
||||||
sys.buzzer(2000);
|
sys.buzzer(2000);
|
||||||
delay(duration);
|
delay(duration);
|
||||||
// turn off buzzer
|
// turn off buzzer
|
||||||
sys.buzzer(0);
|
sys.buzzer(0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LOG_EXT_SENSORS
|
#if LOG_EXT_SENSORS
|
||||||
|
|
|
@ -91,12 +91,14 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
rawHex := hex.EncodeToString(buf[:n])
|
rawHex := hex.EncodeToString(buf[:n])
|
||||||
logger.Warnf(formatLogMsg(addr.IP.String(), dest.Address, dest.Port, fmt.Sprintf(`Error decrypting message: %s. Length: %d, Raw: "%s"`, err, len(rawHex), rawHex)))
|
logger.Warnf(formatLogMsg(addr.IP.String(), dest.Address, dest.Port, fmt.Sprintf(`Error decrypting message: %s. Length: %d, Raw: "%s"`, err, len(rawHex), rawHex)))
|
||||||
// Forward the raw message to the backend without bothering with decryption.
|
plaintext = buf[:n] // Forward the raw message to the backend without bothering with decryption.
|
||||||
plaintext = buf[:n]
|
if len(plaintext) > 0 {
|
||||||
|
logger.Warningf("Encryption failed, possibly recieved unencrypted message -- %s", plaintext)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// If empty message.
|
||||||
plaintext = buf[:n]
|
plaintext = buf[:n]
|
||||||
logger.Warningln("Got unencrypted message!")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forwardAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", dest.Address, dest.Port))
|
forwardAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", dest.Address, dest.Port))
|
||||||
|
|
Loading…
Reference in New Issue