-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
//go:build !unix | ||
// +build !unix | ||
|
||
package internet | ||
|
||
import ( | ||
"fmt" | ||
"github.com/v2fly/v2ray-core/v5/common/net" | ||
) | ||
|
||
func activate_socket(address string) (net.Listener, error) { | ||
return nil, fmt.Errorf("socket activation is not supported on this platform") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//go:build unix | ||
// +build unix | ||
|
||
package internet | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
"syscall" | ||
|
||
"github.com/v2fly/v2ray-core/v5/common/net" | ||
) | ||
|
||
func activate_socket(address string) (net.Listener, error) { | ||
fd, err := strconv.Atoi(address[8:]) | ||
if err != nil { | ||
return nil, err | ||
} | ||
// Ignore the fail of SetNonblock: it's merely an optimization so that Go can poll this fd. | ||
_ = syscall.SetNonblock(fd, true) | ||
return net.FileListener(os.NewFile(uintptr(fd), address)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters