Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
lima-vm
GitHub Repository: lima-vm/lima
Path: blob/master/pkg/portfwd/control_windows.go
2614 views
1
// SPDX-FileCopyrightText: Copyright The Lima Authors
2
// SPDX-License-Identifier: Apache-2.0
3
4
package portfwd
5
6
import (
7
"syscall"
8
9
"golang.org/x/sys/windows"
10
)
11
12
func Control(_, _ string, c syscall.RawConn) (err error) {
13
controlErr := c.Control(func(fd uintptr) {
14
err = windows.SetsockoptInt(windows.Handle(int(fd)), windows.SOL_SOCKET, windows.SO_REUSEADDR, 1)
15
if err != nil {
16
return
17
}
18
})
19
if controlErr != nil {
20
err = controlErr
21
}
22
return err
23
}
24
25