Skip to content

Commit

Permalink
Add EtherType method
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessOne91 committed Jul 20, 2024
1 parent 8e48c26 commit f36baf9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions protocols/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ func EthFrameFromBytes(raw []byte) (*EthernetFrame, error) {
}, nil
}

// Info returns an human-readable string containing all the ETH frame data
func (f *EthernetFrame) Info() string {
etv := etherTypesValues[f.etherType]
func (f EthernetFrame) EtherType() string {
return etherTypesValues[f.etherType]
}

return fmt.Sprintf("%s Ethernet Frame from MAC %s to MAC %s", etv, f.sourceMAC, f.destinationMAC)
// Info returns an human-readable string containing all the ETH frame data
func (f EthernetFrame) Info() string {
return fmt.Sprintf("%s Ethernet Frame from MAC %s to MAC %s", f.EtherType(), f.sourceMAC, f.destinationMAC)
}

0 comments on commit f36baf9

Please sign in to comment.