mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
Refine Android build (#525)
Co-authored-by: ghost <noreply@example.com>
This commit is contained in:
parent
3c988693b5
commit
291eff1aa3
@ -144,7 +144,7 @@ func (c *TrojanServerConfig) Build() (proto.Message, error) {
|
||||
switch fb.Dest[0] {
|
||||
case '@', '/':
|
||||
fb.Type = "unix"
|
||||
if fb.Dest[0] == '@' && len(fb.Dest) > 1 && fb.Dest[1] == '@' && runtime.GOOS == "linux" {
|
||||
if fb.Dest[0] == '@' && len(fb.Dest) > 1 && fb.Dest[1] == '@' && (runtime.GOOS == "linux" || runtime.GOOS == "android") {
|
||||
fullAddr := make([]byte, len(syscall.RawSockaddrUnix{}.Path)) // may need padding to work with haproxy
|
||||
copy(fullAddr, fb.Dest[1:])
|
||||
fb.Dest = string(fullAddr)
|
||||
|
@ -93,7 +93,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
|
||||
switch fb.Dest[0] {
|
||||
case '@', '/':
|
||||
fb.Type = "unix"
|
||||
if fb.Dest[0] == '@' && len(fb.Dest) > 1 && fb.Dest[1] == '@' && runtime.GOOS == "linux" {
|
||||
if fb.Dest[0] == '@' && len(fb.Dest) > 1 && fb.Dest[1] == '@' && (runtime.GOOS == "linux" || runtime.GOOS == "android") {
|
||||
fullAddr := make([]byte, len(syscall.RawSockaddrUnix{}.Path)) // may need padding to work with haproxy
|
||||
copy(fullAddr, fb.Dest[1:])
|
||||
fb.Dest = string(fullAddr)
|
||||
|
@ -136,8 +136,8 @@ func TestHTTPConnectionHeader(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDomainSocket(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Not supported on windows")
|
||||
if runtime.GOOS == "windows" || runtime.GOOS == "android" {
|
||||
t.Skip("Not supported on windows and android")
|
||||
return
|
||||
}
|
||||
tcpServer := tcp.Server{
|
||||
|
@ -1,4 +1,5 @@
|
||||
// +build !windows
|
||||
// +build !android
|
||||
|
||||
package domainsocket_test
|
||||
|
||||
|
@ -54,7 +54,7 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
|
||||
lc.Control = nil
|
||||
network = addr.Network()
|
||||
address = addr.Name
|
||||
if runtime.GOOS == "linux" && address[0] == '@' {
|
||||
if (runtime.GOOS == "linux" || runtime.GOOS == "android") && address[0] == '@' {
|
||||
// linux abstract unix domain socket is lockfree
|
||||
if len(address) > 1 && address[1] == '@' {
|
||||
// but may need padding to work with haproxy
|
||||
|
Loading…
Reference in New Issue
Block a user