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