mirror of
https://github.com/luscis/openlan.git
synced 2025-10-30 20:16:22 +08:00
33 lines
612 B
Go
Executable File
33 lines
612 B
Go
Executable File
package api
|
|
|
|
import (
|
|
"github.com/luscis/openlan/pkg/config"
|
|
"github.com/luscis/openlan/pkg/libol"
|
|
"github.com/luscis/openlan/pkg/network"
|
|
"github.com/luscis/openlan/pkg/schema"
|
|
)
|
|
|
|
type Switcher interface {
|
|
UUID() string
|
|
UpTime() int64
|
|
Alias() string
|
|
Config() *config.Switch
|
|
Server() libol.SocketServer
|
|
Firewall() *network.FireWall
|
|
Reload()
|
|
Save()
|
|
}
|
|
|
|
func NewWorkerSchema(s Switcher) schema.Worker {
|
|
protocol := ""
|
|
if cfg := s.Config(); cfg != nil {
|
|
protocol = cfg.Protocol
|
|
}
|
|
return schema.Worker{
|
|
UUID: s.UUID(),
|
|
Uptime: s.UpTime(),
|
|
Alias: s.Alias(),
|
|
Protocol: protocol,
|
|
}
|
|
}
|