|
|
@ -22,11 +22,13 @@ import (
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
listen = flag.String("listen", "/tmp/qemu.sock", "path to listen on")
|
|
|
|
listen = flag.String("listen", "/tmp/qemu.sock", "path to listen on")
|
|
|
|
nat = flag.String("nat", "easy", "type of NAT to use")
|
|
|
|
nat = flag.String("nat", "easy", "type of NAT to use")
|
|
|
|
nat2 = flag.String("nat2", "hard", "type of NAT to use for second network")
|
|
|
|
nat2 = flag.String("nat2", "hard", "type of NAT to use for second network")
|
|
|
|
portmap = flag.Bool("portmap", false, "enable portmapping")
|
|
|
|
portmap = flag.Bool("portmap", false, "enable portmapping")
|
|
|
|
dgram = flag.Bool("dgram", false, "enable datagram mode; for use with macOS Hypervisor.Framework and VZFileHandleNetworkDeviceAttachment")
|
|
|
|
dgram = flag.Bool("dgram", false, "enable datagram mode; for use with macOS Hypervisor.Framework and VZFileHandleNetworkDeviceAttachment")
|
|
|
|
|
|
|
|
blend = flag.Bool("blend", true, "blend reality (controlplane.tailscale.com and DERPs) into the virtual network")
|
|
|
|
|
|
|
|
pcapFile = flag.String("pcap", "", "if non-empty, filename to write pcap")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
@ -57,6 +59,8 @@ func main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var c vnet.Config
|
|
|
|
var c vnet.Config
|
|
|
|
|
|
|
|
c.SetPCAPFile(*pcapFile)
|
|
|
|
|
|
|
|
c.SetBlendReality(*blend)
|
|
|
|
node1 := c.AddNode(c.AddNetwork("2.1.1.1", "192.168.1.1/24", vnet.NAT(*nat)))
|
|
|
|
node1 := c.AddNode(c.AddNetwork("2.1.1.1", "192.168.1.1/24", vnet.NAT(*nat)))
|
|
|
|
c.AddNode(c.AddNetwork("2.2.2.2", "10.2.0.1/16", vnet.NAT(*nat2)))
|
|
|
|
c.AddNode(c.AddNetwork("2.2.2.2", "10.2.0.1/16", vnet.NAT(*nat2)))
|
|
|
|
if *portmap {
|
|
|
|
if *portmap {
|
|
|
|