package main
Variables
Addresses to exchange:
- var NewIP net.IP
- var NewMAC net.HardwareAddr
- var OldIP net.IP
- var OldMAC net.HardwareAddr
In-/Output to VM and network:
- var NetReader io.Reader
- var NetWriter io.Writer
- var VmReader io.Reader
- var VmWriter io.Writer
DHCP variables:
- var DHCPCandidate net.IP
- var DHCPDNSIP net.IP
- var DHCPIP net.IP
- var DHCPMAC net.HardwareAddr
- var DHCPMask []byte
- var DHCPRouterIP net.IP
- var DHCPState dhcp4.MessageType
- var DHCPXId []byte
User-provided variables:
- var Hostname string
- var Passthrough bool
- var Wireshark bool
UId used as host name:
- var UId string
Functions
func filterIP(prefix string, dst interface{}, src interface{}, context gopacket.LayerType)
filterIP checks whether an IP target selected from src and dst equals a given value. If yes, it is changed
func filterMAC(prefix string, dst interface{}, src interface{}, context gopacket.LayerType)
filterMAC checks whether a MAC target selected from src and dst equals a given value. If yes, it is changed
func filterPayload(prefix string, payload *[]byte)
filterPayloads filters binary payloads to be able to process unsupported protocols
func handleDHCP(content []byte, dstMAC net.HardwareAddr, srcMAC net.HardwareAddr, prefix string)
handleDHCP provides the main DHCP functionality to request an IP from a server on the one hand and provide an IP to the VM on the other hand
func main()
Start the two plugs and run two concurrent forward methods
func pipeForward(prefix string)
Reads from an input and writes to and output, do things to the content in between. Is meant to be run concurrently with "go pipeForward(...)". This is the main loop of the proxy.
func sendDHCPReply(req dhcp4.Packet, mt dhcp4.MessageType, lease net.IP, reqOpt dhcp4.Options, dstMAC net.HardwareAddr)
sendDHCPReply creates a response DHCP packet for the VM and sends it
func sendDHCPRequest(mt dhcp4.MessageType, reqIP net.IP)
sendDHCPRequest creates a request DHCP packet for the server and sends it
Inhaltsverzeichnis
- package main
- Variables
- Addresses to exchange:
- In-/Output to VM and network:
- DHCP variables:
- User-provided variables:
- UId used as host name:
- Functions
- func filterIP(prefix string, dst interface{}, src interface{}, context gopacket.LayerType)
- func filterMAC(prefix string, dst interface{}, src interface{}, context gopacket.LayerType)
- func filterPayload(prefix string, payload *[]byte)
- func handleDHCP(content []byte, dstMAC net.HardwareAddr, srcMAC net.HardwareAddr, prefix string)
- func main()
- func pipeForward(prefix string)
- func sendDHCPReply(req dhcp4.Packet, mt dhcp4.MessageType, lease net.IP, reqOpt dhcp4.Options, dstMAC net.HardwareAddr)
- func sendDHCPRequest(mt dhcp4.MessageType, reqIP net.IP)