Documentation
¶
Index ¶
- type PortID
- type PortState
- type Session
- func (s *Session) CreateVLAN(vid VID) (*http.Response, error)
- func (s *Session) DeleteVLAN(vid VID) (*http.Response, error)
- func (s *Session) FetchSwitchConfig() (*SwitchConfig, error)
- func (s *Session) Logout() (*http.Response, error)
- func (s *Session) SetVLANMembership(vid VID, switchConfig *SwitchConfig) (*http.Response, error)
- func (s *Session) SetVLANName(vid VID, name string) (*http.Response, error)
- type SwitchConfig
- type TrunkConfig
- type TrunkID
- type TrunkMode
- type VID
- type VlanConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
An admin login session on a switch.
It is recommended to call Logout when you're done with the session, because 1810 series switches have a limited number of session slots available. When these are used up, they will reject further logins.
func (*Session) FetchSwitchConfig ¶
func (s *Session) FetchSwitchConfig() (*SwitchConfig, error)
Read out the switches configuration.
func (*Session) SetVLANMembership ¶
Apply the VLAN membership settings in `switchConfig` for the VLAN identified by `vid`.
The intended usage is to fetch `switchConfig` through `FetchSwitchConfig`, modify it as desired, and to then pass it to this function for any VLANs needing modifications.
type SwitchConfig ¶
type SwitchConfig struct { // Port VLANs of all switch ports. Array index corresponds to port number // minus one. PvidPort []VID // Port VLANs of all active trunks. PvidTrunk []VID // IDs of all active trunks. TrunkID []TrunkID VLANs []VlanConfig Trunks []TrunkConfig }
Representation of a switches entire configuration.
For `PvidTrunk` and `TrunkID`, trunks are considered "active" when they have at least one member port.
func (*SwitchConfig) GetTrunk ¶
func (sc *SwitchConfig) GetTrunk(trunkID TrunkID) *TrunkConfig
Look up a `TrunkConfig` by its ID.
func (*SwitchConfig) GetVLAN ¶
func (sc *SwitchConfig) GetVLAN(vid VID) *VlanConfig
Look up a `VlanConfig` by its VLAN ID.
type TrunkConfig ¶
Represents the configuration of a trunk.