fix: update NetworkConfig type in config.go

This commit is contained in:
Siyuan 2025-10-09 21:05:31 +00:00
parent 52ddc9ebe5
commit a9cd36c5fb
2 changed files with 27 additions and 97 deletions

View File

@ -102,7 +102,7 @@ type Config struct {
TLSMode string `json:"tls_mode"` // options: "self-signed", "user-defined", ""
UsbConfig *usbgadget.Config `json:"usb_config"`
UsbDevices *usbgadget.Devices `json:"usb_devices"`
NetworkConfig *network.NetworkConfig `json:"network_config"`
NetworkConfig *types.NetworkConfig `json:"network_config"`
DefaultLogLevel string `json:"default_log_level"`
VideoSleepAfterSec int `json:"video_sleep_after_sec"`
}

View File

@ -192,76 +192,6 @@ func (c *Client) ensureInterfaceUp(ifname string) (*link.Link, error) {
return nlm.EnsureInterfaceUpWithTimeout(c.ctx, iface, c.cfg.LinkUpTimeout)
}
// func (c *Client) sendInitialRequests() chan any {
// return c.sendRequests(c.cfg.IPv4, c.cfg.IPv6)
// }
// func (c *Client) sendRequestsFamily(
// family int,
// wg *sync.WaitGroup,
// r *chan any,
// l *zerolog.Logger,
// iface *link.Link,
// ) {
// wg.Add(1)
// go func(iface *link.Link) {
// defer wg.Done()
// var (
// lease *Lease
// err error
// )
// switch family {
// case link.AfInet:
// lease, err = c.requestLease4(iface)
// case link.AfInet6:
// lease, err = c.requestLease6(iface)
// }
// if err != nil {
// l.Error().Err(err).Msg("Could not get lease")
// return
// }
// (*r) <- lease
// }(iface)
// }
// func (c *Client) sendRequests(ipv4, ipv6 bool) chan any {
// c.mu.Lock()
// defer c.mu.Unlock()
// // Yeah, this is a hack, until we can cancel all leases in progress.
// r := make(chan any, 3*len(c.ifaces))
// var wg sync.WaitGroup
// for _, iface := range c.ifaces {
// wg.Add(1)
// go func(ifname string) {
// defer wg.Done()
// l := c.l.With().Str("interface", ifname).Logger()
// iface, err := c.ensureInterfaceUp(ifname)
// if err != nil {
// l.Error().Err(err).Msg("Could not bring up interface")
// return
// }
// if ipv4 {
// c.sendRequestsFamily(link.AfInet, &wg, &r, &l, iface)
// }
// if ipv6 {
// c.sendRequestsFamily(link.AfInet6, &wg, &r, &l, iface)
// }
// }(iface)
// }
// go func() {
// wg.Wait()
// close(r)
// }()
// return r
// }
// Lease4 returns the current IPv4 lease
func (c *Client) Lease4() *types.DHCPLease {
c.lease4Mu.Lock()