pat/cfg/ax25_engine.go
Martin Hebnes Pedersen d716296b52 Add support for AGWPE (e.g. Direwolf) over TCP
This eliminates the need for Linux's AX25 stack when using Direwolf or
AGWPE TNCs. It makes AGWPE the default AX.25 engine if the build does
not include Linux AX.25 support.

Direwolf >= v1.6 is recommended (< v1.2 is unsupported).

Closes #367
2023-02-21 11:14:17 +01:00

28 lines
533 B
Go

package cfg
import (
"encoding/json"
"fmt"
)
const (
AX25EngineAGWPE AX25Engine = "agwpe"
AX25EngineLinux = "linux"
AX25EngineSerialTNC = "serial-tnc"
)
type AX25Engine string
func (a *AX25Engine) UnmarshalJSON(p []byte) error {
var str string
if err := json.Unmarshal(p, &str); err != nil {
return err
}
switch v := AX25Engine(str); v {
case AX25EngineLinux, AX25EngineAGWPE, AX25EngineSerialTNC:
*a = v
return nil
default:
return fmt.Errorf("invalid AX.25 engine '%s'", v)
}
}