mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 16:27:33 -10:00
The proxy owns the links' addresses and domain and the proxy user: proxy.IsLinkAddr, proxy.LinkAddr, proxy.LinkDomain and proxy.ProxyUser replace vm.IsLinkAddr, vmssh.IsLinkAddr, vm.LinkNet, vm's linkNetAddr, vm.LinkDomain, netpolicy.LinkDomain and the proxy's own isLinkAddr and linkDomain. TestLinkAddrsAgree goes, because there's nothing left to agree. The proxy's link list now refuses an IPv4-mapped address too, as vm's parser already did. backend owns the guest's view of a proxy: ProxyUser (proxy.ProxyUser), ProxyURL, GuestProxyVars, ClientProxyVars and NewProxyPassword replace four URL builders (BuildProxy.URL, Lima's, Docker's and smolvm's), the user written out in three places (netpolicy.ProxyUser, buildProxyUser, Docker's proxyUser), the guest's variable list in three (Lima's inline loop, smolvm.proxyVars, Docker's proxyVars) and the client's in two (limaProxyVars, Docker's noClientProxy list), and the two password generators. Confinement.ProxyUser goes: Docker ignored it, and every backend now uses ProxyUser. A new VM's proxy key is NewProxyPassword's 64 hex digits, as a build proxy's was; a VM keeps the key it has. doctor reads HTTPS_PROXY through backend.ReadHostProxy. In the proxy, hijack and splice replace the three CONNECT copies (tunnels to allowed hosts, tunnels to links, interception's hijack) and the relay's pipe. A tunnel passes the bytes as they are, passes on the end of what the client sent, and ends, closing both connections, when the server's bytes end or the client has gone. A relayed connection now ends with the proxy's side too, where before it waited for both. Tests: splice_test.go characterises the allowed-host tunnel, the link tunnel and the relay (a megabyte of every byte value, a half-close answered, a client that goes away ending the tunnel), written against the code before this change; TestSpliceEnds, TestHijack and TestIsLinkAddr (every LinkAddr) are new, and so are TestProxyURL, TestNewProxyPassword and TestProxyVars. TestLinkListRefused gains a mapped address. e2e: the relaunch without a company proxy says which step failed, with the launch's output, the VM's status and the proxy's log, and a link helper that doesn't start shows its output. Co-Authored-By: Claude Opus 5.5 <[email protected]>