commit caa316809fc00053a70b6345a35caac263b7a086 Author: MrMcX Date: Mon Dec 27 13:56:33 2021 +0100 Documentation diff --git a/Documentation.md b/Documentation.md new file mode 100644 index 0000000..3b18576 --- /dev/null +++ b/Documentation.md @@ -0,0 +1,48 @@ +## Variables + +- var **DHCPCandidate** net.IP +- var **DHCPIP** net.IP +- var **DHCPMAC** net.HardwareAddr +- var **DHCPMask** []byte +- var **DHCPState** dhcp4.MessageType +- var **DNSIP** net.IP +- var **Hostname** string +- var **NetReader** io.Reader +- var **NetWriter** io.Writer +- var **NewIP** net.IP +- var **NewMAC** net.HardwareAddr +- var **OldIP** net.IP +- var **OldMAC** net.HardwareAddr +- var **Passthrough** bool +- var **RouterIP** net.IP +- var **UId** string +- var **VmReader** io.Reader +- var **VmWriter** io.Writer +- var **Wireshark** bool +- var **XId** []byte + +## 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 \ No newline at end of file