AddInterface 添加 Interface
(iface Interface)
| 178 | |
| 179 | // AddInterface 添加 Interface |
| 180 | func (os *AsterOS) AddInterface(iface Interface) error { |
| 181 | os.ifMu.Lock() |
| 182 | defer os.ifMu.Unlock() |
| 183 | |
| 184 | name := iface.Name() |
| 185 | if _, exists := os.interfaces[name]; exists { |
| 186 | return ErrInterfaceExists |
| 187 | } |
| 188 | |
| 189 | os.interfaces[name] = iface |
| 190 | return nil |
| 191 | } |
| 192 | |
| 193 | // RemoveInterface 移除 Interface |
| 194 | func (os *AsterOS) RemoveInterface(name string) error { |