mirror of
https://github.com/la5nta/pat
synced 2026-08-13 17:46:54 -04:00
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
28 lines
533 B
Go
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)
|
|
}
|
|
}
|