tstest/natlab: get tailscaled logs from gokrazy via syslog

Using https://github.com/gokrazy/gokrazy/pull/275

This is much lower latency than logcatcher, which is higher latency
and chunkier. And this is better than getting it via 'tailscale debug
daemon-logs', which misses early interesting logs.

Updates #13038

Change-Id: I499ec254c003a9494c0e9910f9c650c8ac44ef33
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-08-12 21:39:28 -07:00
committed by Brad Fitzpatrick
parent 10662c4282
commit 10d0ce8dde
6 changed files with 53 additions and 55 deletions

View File

@@ -73,9 +73,12 @@ func (c *Config) AddNode(opts ...any) *Node {
case TailscaledEnv:
n.env = append(n.env, o)
case NodeOption:
if o == HostFirewall {
switch o {
case HostFirewall:
n.hostFW = true
} else {
case VerboseSyslog:
n.verboseSyslog = true
default:
if n.err == nil {
n.err = fmt.Errorf("unknown NodeOption %q", o)
}
@@ -93,7 +96,8 @@ func (c *Config) AddNode(opts ...any) *Node {
type NodeOption string
const (
HostFirewall NodeOption = "HostFirewall"
HostFirewall NodeOption = "HostFirewall"
VerboseSyslog NodeOption = "VerboseSyslog"
)
// TailscaledEnv is а option that can be passed to Config.AddNode
@@ -148,8 +152,9 @@ type Node struct {
err error
n *node // nil until NewServer called
env []TailscaledEnv
hostFW bool
env []TailscaledEnv
hostFW bool
verboseSyslog bool
// TODO(bradfitz): this is halfway converted to supporting multiple NICs
// but not done. We need a MAC-per-Network.
@@ -171,6 +176,14 @@ func (n *Node) HostFirewall() bool {
return n.hostFW
}
func (n *Node) VerboseSyslog() bool {
return n.verboseSyslog
}
func (n *Node) SetVerboseSyslog(v bool) {
n.verboseSyslog = v
}
// Network returns the first network this node is connected to,
// or nil if none.
func (n *Node) Network() *Network {
@@ -277,8 +290,9 @@ func (s *Server) initFromConfig(c *Config) error {
return conf.err
}
n := &node{
mac: conf.mac,
net: netOfConf[conf.Network()],
mac: conf.mac,
net: netOfConf[conf.Network()],
verboseSyslog: conf.VerboseSyslog(),
}
n.interfaceID = must.Get(s.pcapWriter.AddInterface(pcapgo.NgInterface{
Name: fmt.Sprintf("node%d", i+1),