Documentation
¶
Index ¶
- Constants
- Variables
- func DeleteResource(server ServerData, query string) error
- func FixResourcesForJSON(res *ResourcesContainerModel)
- func IsConnected(got *ResourcesContainerModel, t1, t2 treeNode) bool
- func IsVMConnected(got *ResourcesContainerModel, uid1, uid2 string) bool
- func PutResource[A json.Unmarshaler](server ServerData, query string, resource A) error
- func TryUnmarshalError(b []byte) ([]string, error)
- func Unmarshal2Fields[fieldType1 any, fieldType2 any](b []byte, entry1 string, field1 *fieldType1, entry2 string, field2 *fieldType2) error
- func UnmarshalBaseStructAnd1Field[baseType any, fieldType1 any](b []byte, base *baseType, entry1 string, field1 *fieldType1) error
- func UnmarshalBaseStructAnd2Fields[baseType any, fieldType1 any, fieldType2 any](b []byte, base *baseType, entry1 string, field1 *fieldType1, entry2 string, ...) error
- func UnmarshalBaseStructAnd4Fields[baseType any, fieldType1 any, fieldType2 any, fieldType3 any, fieldType4 any](b []byte, base *baseType, entry1 string, field1 *fieldType1, entry2 string, ...) error
- type ALGTypeServiceEntry
- type Condition
- type ConjunctionOperator
- type DfwCategory
- type Domain
- type DomainResources
- type EtherTypeServiceEntry
- type Expression
- type ExpressionElement
- type ExternalIDExpression
- type FirewallRule
- type GatewayPolicy
- type Group
- type ICMPTypeServiceEntry
- type IGMPTypeServiceEntry
- type IPAddressExpression
- type IPProtocolServiceEntry
- type IdentityGroupExpression
- type L4PortSetServiceEntry
- type MACAddressExpression
- type NestedExpression
- type NestedServiceServiceEntry
- type PathExpression
- type PolicyNat
- type PolicyNatRule
- type PolicyTraceflowObservationDelivered
- type PolicyTraceflowObservationDropped
- type PolicyTraceflowObservationDroppedLogical
- type PolicyTraceflowObservationForwardedLogical
- type PolicyTraceflowObservationReceivedLogical
- type PolicyTraceflowObservationRelayedLogical
- type RealizedVirtualMachine
- type RedirectionPolicy
- type RedirectionRule
- type ResourcesContainerModel
- func (resources *ResourcesContainerModel) CreateTopologyGraph(g common.Graph)
- func (resources *ResourcesContainerModel) GetRule(id string) *FirewallRule
- func (resources *ResourcesContainerModel) GetSegment(query string) *Segment
- func (resources *ResourcesContainerModel) GetSegmentPort(id string) *SegmentPort
- func (resources *ResourcesContainerModel) GetService(query string) *Service
- func (resources *ResourcesContainerModel) GetTier0(query string) *Tier0
- func (resources *ResourcesContainerModel) GetTier1(query string) *Tier1
- func (resources *ResourcesContainerModel) GetVirtualMachine(id string) *VirtualMachine
- func (resources *ResourcesContainerModel) GetVirtualMachineAddresses(vmID string) []string
- func (resources *ResourcesContainerModel) GetVirtualNetworkInterfaceByAddress(address string) *VirtualNetworkInterface
- func (resources *ResourcesContainerModel) GetVirtualNetworkInterfaceByPort(portID string) *VirtualNetworkInterface
- func (resources *ResourcesContainerModel) OutputTopologyGraph(fileName, format string) (res string, err error)
- func (resources *ResourcesContainerModel) ToJSONString() (string, error)
- type Rule
- type SecurityPolicy
- type Segment
- type SegmentPort
- type ServerData
- type Service
- type ServiceEntries
- type ServiceEntry
- type Tag
- type Tier0
- type Tier1
- type TraceFlowObservationElement
- type TraceFlowObservations
- type TraceFlowProtocol
- type TraceFlows
- type TraceflowConfig
- type TraceflowObservationDelivered
- type TraceflowObservationDropped
- type TraceflowObservationDroppedLogical
- type TraceflowObservationForwarded
- type TraceflowObservationForwardedLogical
- type TraceflowObservationProtected
- type TraceflowObservationReceived
- type TraceflowObservationReceivedLogical
- type TraceflowObservationRelayedLogical
- type TraceflowObservationReplicationLogical
- type VirtualMachine
- type VirtualNetworkInterface
Constants ¶
const ( EthernetStr = "Ethernet" EmergencyStr = "Emergency" InfrastructureStr = "Infrastructure" EnvironmentStr = "Environment" ApplicationStr = "Application" EmptyStr = "<Empty>" )
const ( ProtocolTCP = "tcp" ProtocolUDP = "udp" ProtocolICMP = "icmp" TCPFlagSYN = 2 )
Variables ¶
var CategoriesList = []DfwCategory{ EthernetCategory, EmergencyCategory, InfrastructureCategory, EnvCategory, AppCategoty, EmptyCategory, }
Functions ¶
func DeleteResource ¶
func DeleteResource(server ServerData, query string) error
func FixResourcesForJSON ¶
func FixResourcesForJSON(res *ResourcesContainerModel)
func IsConnected ¶
func IsConnected(got *ResourcesContainerModel, t1, t2 treeNode) bool
func IsVMConnected ¶
func IsVMConnected(got *ResourcesContainerModel, uid1, uid2 string) bool
func PutResource ¶
func PutResource[A json.Unmarshaler](server ServerData, query string, resource A) error
func TryUnmarshalError ¶
func Unmarshal2Fields ¶
Types ¶
type ALGTypeServiceEntry ¶
type ALGTypeServiceEntry struct {
nsx.ALGTypeServiceEntry
}
func (*ALGTypeServiceEntry) String ¶
func (e *ALGTypeServiceEntry) String() string
func (*ALGTypeServiceEntry) ToConnection ¶
func (e *ALGTypeServiceEntry) ToConnection() (*netset.TransportSet, error)
type ConjunctionOperator ¶
type ConjunctionOperator struct {
nsx.ConjunctionOperator
}
func (*ConjunctionOperator) String ¶
func (e *ConjunctionOperator) String() string
type DfwCategory ¶
type DfwCategory int
const ( EthernetCategory DfwCategory = iota EmergencyCategory InfrastructureCategory EnvCategory AppCategoty EmptyCategory )
func MinCategory ¶
func MinCategory() DfwCategory
func (DfwCategory) String ¶
func (d DfwCategory) String() string
type Domain ¶
type Domain struct { nsx.Domain Resources DomainResources `json:"resources"` }
func (*Domain) UnmarshalJSON ¶
type DomainResources ¶
type DomainResources struct { SecurityPolicyList []SecurityPolicy `json:"security_policies"` GatewayPolicyList []GatewayPolicy `json:"gateway_policies"` RedirectionPolicyList []RedirectionPolicy `json:"redirection_policies"` GroupList []Group `json:"groups"` }
func (*DomainResources) GetGroup ¶
func (resources *DomainResources) GetGroup(query string) *Group
type EtherTypeServiceEntry ¶
type EtherTypeServiceEntry struct {
nsx.EtherTypeServiceEntry
}
func (*EtherTypeServiceEntry) String ¶
func (e *EtherTypeServiceEntry) String() string
func (*EtherTypeServiceEntry) ToConnection ¶
func (e *EtherTypeServiceEntry) ToConnection() (*netset.TransportSet, error)
type Expression ¶
type Expression []ExpressionElement
func (*Expression) String ¶
func (e *Expression) String() string
func (*Expression) UnmarshalJSON ¶
func (e *Expression) UnmarshalJSON(b []byte) error
type ExpressionElement ¶
type ExpressionElement interface {
String() string
}
type ExternalIDExpression ¶
type ExternalIDExpression struct {
nsx.ExternalIDExpression
}
func (*ExternalIDExpression) String ¶
func (e *ExternalIDExpression) String() string
type FirewallRule ¶
type FirewallRule struct {
nsx.FirewallRule
}
type GatewayPolicy ¶
type GatewayPolicy struct { nsx.GatewayPolicy Rules []Rule `json:"rules,omitempty"` }
/////////////////////////////////////////////////////////////////////////////////////
func (*GatewayPolicy) UnmarshalJSON ¶
func (gatewayPolicy *GatewayPolicy) UnmarshalJSON(b []byte) error
type Group ¶
type Group struct { nsx.Group VMMembers []RealizedVirtualMachine `json:"vm_members,omitempty"` VIFMembers []VirtualNetworkInterface `json:"vif_members,omitempty"` AddressMembers []nsx.IPElement `json:"ips_members,omitempty"` Expression Expression `json:"expression,omitempty"` }
func (*Group) Description ¶
func (*Group) UnmarshalJSON ¶
type ICMPTypeServiceEntry ¶
type ICMPTypeServiceEntry struct {
nsx.ICMPTypeServiceEntry
}
func (*ICMPTypeServiceEntry) String ¶
func (e *ICMPTypeServiceEntry) String() string
func (*ICMPTypeServiceEntry) ToConnection ¶
func (e *ICMPTypeServiceEntry) ToConnection() (*netset.TransportSet, error)
type IGMPTypeServiceEntry ¶
type IGMPTypeServiceEntry struct {
nsx.IGMPTypeServiceEntry
}
func (*IGMPTypeServiceEntry) String ¶
func (e *IGMPTypeServiceEntry) String() string
func (*IGMPTypeServiceEntry) ToConnection ¶
func (e *IGMPTypeServiceEntry) ToConnection() (*netset.TransportSet, error)
type IPAddressExpression ¶
type IPAddressExpression struct {
nsx.IPAddressExpression
}
func (*IPAddressExpression) String ¶
func (e *IPAddressExpression) String() string
type IPProtocolServiceEntry ¶
type IPProtocolServiceEntry struct {
nsx.IPProtocolServiceEntry
}
/////////////////////////////////////////////////////////////////////////////////////
func (*IPProtocolServiceEntry) String ¶
func (e *IPProtocolServiceEntry) String() string
func (*IPProtocolServiceEntry) ToConnection ¶
func (e *IPProtocolServiceEntry) ToConnection() (*netset.TransportSet, error)
type IdentityGroupExpression ¶
type IdentityGroupExpression struct {
nsx.IdentityGroupExpression
}
func (*IdentityGroupExpression) String ¶
func (e *IdentityGroupExpression) String() string
type L4PortSetServiceEntry ¶
type L4PortSetServiceEntry struct {
nsx.L4PortSetServiceEntry
}
func (*L4PortSetServiceEntry) String ¶
func (e *L4PortSetServiceEntry) String() string
func (*L4PortSetServiceEntry) ToConnection ¶
func (e *L4PortSetServiceEntry) ToConnection() (*netset.TransportSet, error)
type MACAddressExpression ¶
type MACAddressExpression struct {
nsx.MACAddressExpression
}
func (*MACAddressExpression) String ¶
func (e *MACAddressExpression) String() string
type NestedExpression ¶
type NestedExpression struct {
nsx.NestedExpression
}
func (*NestedExpression) String ¶
func (e *NestedExpression) String() string
type NestedServiceServiceEntry ¶
type NestedServiceServiceEntry struct {
nsx.NestedServiceServiceEntry
}
func (*NestedServiceServiceEntry) String ¶
func (e *NestedServiceServiceEntry) String() string
func (*NestedServiceServiceEntry) ToConnection ¶
func (e *NestedServiceServiceEntry) ToConnection() (*netset.TransportSet, error)
type PathExpression ¶
type PathExpression struct {
nsx.PathExpression
}
func (*PathExpression) String ¶
func (e *PathExpression) String() string
type PolicyNat ¶
type PolicyNat struct { nsx.PolicyNat Rules []PolicyNatRule `json:"rules,omitempty"` }
func (*PolicyNat) UnmarshalJSON ¶
type PolicyNatRule ¶
type PolicyNatRule struct {
nsx.PolicyNatRule
}
type PolicyTraceflowObservationDelivered ¶
type PolicyTraceflowObservationDelivered struct {
nsx.PolicyTraceflowObservationDelivered
}
type PolicyTraceflowObservationDropped ¶
type PolicyTraceflowObservationDropped struct {
nsx.PolicyTraceflowObservationDropped
}
type PolicyTraceflowObservationDroppedLogical ¶
type PolicyTraceflowObservationDroppedLogical struct {
nsx.PolicyTraceflowObservationDroppedLogical
}
type PolicyTraceflowObservationForwardedLogical ¶
type PolicyTraceflowObservationForwardedLogical struct {
nsx.PolicyTraceflowObservationForwardedLogical
}
type PolicyTraceflowObservationReceivedLogical ¶
type PolicyTraceflowObservationReceivedLogical struct {
nsx.PolicyTraceflowObservationReceivedLogical
}
type PolicyTraceflowObservationRelayedLogical ¶
type PolicyTraceflowObservationRelayedLogical struct {
nsx.PolicyTraceflowObservationRelayedLogical
}
type RealizedVirtualMachine ¶
type RealizedVirtualMachine struct {
nsx.RealizedVirtualMachine
}
type RedirectionPolicy ¶
type RedirectionPolicy struct { nsx.RedirectionPolicy RedirectionRules []RedirectionRule `json:"rules,omitempty"` }
/////////////////////////////////////////////////////////////////////////////////////
func (*RedirectionPolicy) UnmarshalJSON ¶
func (redirectionPolicy *RedirectionPolicy) UnmarshalJSON(b []byte) error
type RedirectionRule ¶
type RedirectionRule struct { nsx.RedirectionRule ServiceEntries ServiceEntries `json:"service_entries,omitempty"` }
func (*RedirectionRule) UnmarshalJSON ¶
func (rule *RedirectionRule) UnmarshalJSON(b []byte) error
type ResourcesContainerModel ¶
type ResourcesContainerModel struct { ServiceList []Service `json:"services"` VirtualMachineList []VirtualMachine `json:"virtual_machines"` VirtualNetworkInterfaceList []VirtualNetworkInterface `json:"virtual_network_interface"` SegmentList []Segment `json:"segments"` Tier0List []Tier0 `json:"tier0"` Tier1List []Tier1 `json:"tier1"` DomainList []Domain `json:"domains"` }
ResourcesContainerModel defines the model of a container for all resource types we can collect
func CollectResources ¶
func CollectResources(server ServerData) (*ResourcesContainerModel, error)
func FromJSONString ¶
func FromJSONString(b []byte) (*ResourcesContainerModel, error)
func NewResourcesContainerModel ¶
func NewResourcesContainerModel() *ResourcesContainerModel
NewResourcesContainerModel creates an empty resources container
func (*ResourcesContainerModel) CreateTopologyGraph ¶
func (resources *ResourcesContainerModel) CreateTopologyGraph(g common.Graph)
func (*ResourcesContainerModel) GetRule ¶
func (resources *ResourcesContainerModel) GetRule(id string) *FirewallRule
func (*ResourcesContainerModel) GetSegment ¶
func (resources *ResourcesContainerModel) GetSegment(query string) *Segment
func (*ResourcesContainerModel) GetSegmentPort ¶
func (resources *ResourcesContainerModel) GetSegmentPort(id string) *SegmentPort
func (*ResourcesContainerModel) GetService ¶
func (resources *ResourcesContainerModel) GetService(query string) *Service
func (*ResourcesContainerModel) GetTier0 ¶
func (resources *ResourcesContainerModel) GetTier0(query string) *Tier0
func (*ResourcesContainerModel) GetTier1 ¶
func (resources *ResourcesContainerModel) GetTier1(query string) *Tier1
func (*ResourcesContainerModel) GetVirtualMachine ¶
func (resources *ResourcesContainerModel) GetVirtualMachine(id string) *VirtualMachine
func (*ResourcesContainerModel) GetVirtualMachineAddresses ¶
func (resources *ResourcesContainerModel) GetVirtualMachineAddresses(vmID string) []string
func (*ResourcesContainerModel) GetVirtualNetworkInterfaceByAddress ¶
func (resources *ResourcesContainerModel) GetVirtualNetworkInterfaceByAddress(address string) *VirtualNetworkInterface
func (*ResourcesContainerModel) GetVirtualNetworkInterfaceByPort ¶
func (resources *ResourcesContainerModel) GetVirtualNetworkInterfaceByPort(portID string) *VirtualNetworkInterface
func (*ResourcesContainerModel) OutputTopologyGraph ¶
func (resources *ResourcesContainerModel) OutputTopologyGraph(fileName, format string) (res string, err error)
func (*ResourcesContainerModel) ToJSONString ¶
func (resources *ResourcesContainerModel) ToJSONString() (string, error)
ToJSONString converts a ResourcesContainerModel into a json-formatted-string
type Rule ¶
type Rule struct { nsx.Rule FirewallRule *FirewallRule `json:"firewall_rule,omitempty"` ServiceEntries ServiceEntries `json:"service_entries,omitempty"` }
func (*Rule) UnmarshalJSON ¶
type SecurityPolicy ¶
type SecurityPolicy struct { nsx.SecurityPolicy Rules []Rule `json:"rules,omitempty"` DefaultRule *FirewallRule `json:"default_rule,omitempty"` }
func (*SecurityPolicy) UnmarshalJSON ¶
func (securityPolicy *SecurityPolicy) UnmarshalJSON(b []byte) error
type Segment ¶
type Segment struct { nsx.Segment SegmentPorts []SegmentPort `json:"segment_ports,omitempty"` }
func (*Segment) UnmarshalJSON ¶
type SegmentPort ¶
type SegmentPort struct {
nsx.SegmentPort
}
type ServerData ¶
type ServerData struct {
// contains filtered or unexported fields
}
func GetNSXServerDate ¶
func GetNSXServerDate(host, user, password string) (ServerData, error)
func NewServerData ¶
func NewServerData(host, user, password string) ServerData
type Service ¶
type Service struct { nsx.Service ServiceEntries ServiceEntries `json:"service_entries,omitempty"` }
func (*Service) UnmarshalJSON ¶
type ServiceEntries ¶
type ServiceEntries []ServiceEntry
func (*ServiceEntries) MarshalJSON ¶
func (s *ServiceEntries) MarshalJSON() ([]byte, error)
func (*ServiceEntries) UnmarshalJSON ¶
func (s *ServiceEntries) UnmarshalJSON(b []byte) error
type ServiceEntry ¶
type ServiceEntry interface { ToConnection() (*netset.TransportSet, error) String() string }
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag a tag used by VMs for labeling in NSX
type Tier0 ¶
func (*Tier0) UnmarshalJSON ¶
type Tier1 ¶
func (*Tier1) UnmarshalJSON ¶
type TraceFlowObservationElement ¶
type TraceFlowObservationElement interface{}
type TraceFlowObservations ¶
type TraceFlowObservations []TraceFlowObservationElement
func (*TraceFlowObservations) UnmarshalJSON ¶
func (tfs *TraceFlowObservations) UnmarshalJSON(b []byte) error
type TraceFlowProtocol ¶
type TraceFlows ¶
type TraceFlows struct { Tfs []*traceFlow // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////////////////////////////////
func NewTraceflows ¶
func NewTraceflows(resources *ResourcesContainerModel, server ServerData) *TraceFlows
func (*TraceFlows) AddTraceFlow ¶
func (traceFlows *TraceFlows) AddTraceFlow(src, dst string, protocol TraceFlowProtocol, analyzeAllowed bool, srcRuleID, dstRuleID []int, connection string)
func (*TraceFlows) Execute ¶
func (traceFlows *TraceFlows) Execute()
func (*TraceFlows) Summary ¶
func (traceFlows *TraceFlows) Summary()
func (*TraceFlows) ToJSONString ¶
func (traceFlows *TraceFlows) ToJSONString() (string, error)
ToJSONString converts a traceFlows into a json-formatted-string, it converts only the Tfs
type TraceflowConfig ¶
type TraceflowConfig struct { // Configuration of packet data Packet *nsx.FieldsPacketData `json:"packet,omitempty" yaml:"packet,omitempty" mapstructure:"packet,omitempty"` // Policy path or UUID (validated for syntax only) of segment port to start // traceflow from. Auto-plumbed ports don't have corresponding policy path. Both // overlay backed port and VLAN backed port are supported. SourceID *string `json:"source_id,omitempty"` }
///////////////////////////////////////////////////////////////////////////////////////
func (*TraceflowConfig) UnmarshalJSON ¶
func (config *TraceflowConfig) UnmarshalJSON(b []byte) error
type TraceflowObservationDelivered ¶
type TraceflowObservationDelivered struct {
nsx.TraceflowObservationDelivered
}
type TraceflowObservationDropped ¶
type TraceflowObservationDropped struct {
nsx.TraceflowObservationDropped
}
type TraceflowObservationDroppedLogical ¶
type TraceflowObservationDroppedLogical struct {
nsx.TraceflowObservationDroppedLogical
}
type TraceflowObservationForwarded ¶
type TraceflowObservationForwarded struct {
nsx.TraceflowObservationForwarded
}
type TraceflowObservationForwardedLogical ¶
type TraceflowObservationForwardedLogical struct {
nsx.TraceflowObservationForwardedLogical
}
type TraceflowObservationProtected ¶
type TraceflowObservationProtected struct {
nsx.TraceflowObservationProtected
}
type TraceflowObservationReceived ¶
type TraceflowObservationReceived struct {
nsx.TraceflowObservationReceived
}
type TraceflowObservationReceivedLogical ¶
type TraceflowObservationReceivedLogical struct {
nsx.TraceflowObservationReceivedLogical
}
type TraceflowObservationRelayedLogical ¶
type TraceflowObservationRelayedLogical struct {
nsx.TraceflowObservationRelayedLogical
}
type TraceflowObservationReplicationLogical ¶
type TraceflowObservationReplicationLogical struct {
nsx.TraceflowObservationReplicationLogical
}
type VirtualMachine ¶
type VirtualMachine struct {
nsx.VirtualMachine
}
func (*VirtualMachine) Kind ¶
func (vm *VirtualMachine) Kind() string
func (*VirtualMachine) Name ¶
func (vm *VirtualMachine) Name() string
type VirtualNetworkInterface ¶
type VirtualNetworkInterface struct {
nsx.VirtualNetworkInterface
}
func (*VirtualNetworkInterface) Kind ¶
func (vni *VirtualNetworkInterface) Kind() string
func (*VirtualNetworkInterface) Name ¶
func (vni *VirtualNetworkInterface) Name() string
func (*VirtualNetworkInterface) UnmarshalJSON ¶
func (vni *VirtualNetworkInterface) UnmarshalJSON(b []byte) error