Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
AnGgIt86 committed Sep 7, 2024
2 parents 23d7df8 + 2df580b commit 1fd88bb
Show file tree
Hide file tree
Showing 94 changed files with 2,545 additions and 423 deletions.
45 changes: 33 additions & 12 deletions AndroidLibXrayLite/libv2ray_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ func (d *ProtectedDialer) Dial(ctx context.Context,
}

curIP := d.vServer.currentIP()
conn, err := d.fdConn(ctx, curIP, d.vServer.Port, fd)
conn, err := d.fdConn(ctx, curIP, d.vServer.Port, dest.Network, fd)
if err != nil {
d.vServer.NextIP()
return nil, err
Expand All @@ -273,14 +273,14 @@ func (d *ProtectedDialer) Dial(ctx context.Context,

// use the first resolved address.
// the result IP may vary, eg: IPv6 addrs comes first if client has ipv6 address
return d.fdConn(ctx, resolved.IPs[0], resolved.Port, fd)
return d.fdConn(ctx, resolved.IPs[0], resolved.Port, dest.Network, fd)
}

func (d *ProtectedDialer) DestIpAddress() net.IP {
return d.vServer.currentIP()
}

func (d *ProtectedDialer) fdConn(ctx context.Context, ip net.IP, port int, fd int) (net.Conn, error) {
func (d *ProtectedDialer) fdConn(ctx context.Context, ip net.IP, port int, network v2net.Network, fd int) (net.Conn, error) {

defer unix.Close(fd)

Expand All @@ -295,9 +295,16 @@ func (d *ProtectedDialer) fdConn(ctx context.Context, ip net.IP, port int, fd in
}
copy(sa.Addr[:], ip.To16())

if err := unix.Connect(fd, sa); err != nil {
log.Printf("fdConn unix.Connect err, Close Fd: %d Err: %v", fd, err)
return nil, err
if network == v2net.Network_UDP {
if err := unix.Bind(fd, &unix.SockaddrInet6{}); err != nil {
log.Printf("fdConn unix.Bind err, Close Fd: %d Err: %v", fd, err)
return nil, err
}
} else {
if err := unix.Connect(fd, sa); err != nil {
log.Printf("fdConn unix.Connect err, Close Fd: %d Err: %v", fd, err)
return nil, err
}
}

file := os.NewFile(uintptr(fd), "Socket")
Expand All @@ -308,11 +315,25 @@ func (d *ProtectedDialer) fdConn(ctx context.Context, ip net.IP, port int, fd in

defer file.Close()
//Closing conn does not affect file, and closing file does not affect conn.
conn, err := net.FileConn(file)
if err != nil {
log.Printf("fdConn FileConn Close Fd: %d Err: %v", fd, err)
return nil, err
if network == v2net.Network_UDP {
packetConn, err := net.FilePacketConn(file)
if err != nil {
log.Printf("fdConn FilePacketConn Close Fd: %d Err: %v", fd, err)
return nil, err
}
return &v2internet.PacketConnWrapper{
Conn: packetConn,
Dest: &net.UDPAddr{
IP: ip,
Port: port,
},
}, nil
} else {
conn, err := net.FileConn(file)
if err != nil {
log.Printf("fdConn FileConn Close Fd: %d Err: %v", fd, err)
return nil, err
}
return conn, nil
}

return conn, nil
}
Binary file removed app/libs/particlesview-1.0.9.aar
Binary file not shown.
33 changes: 27 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
android:name="com.neko.splash.SplashActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/uwu_splash_theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -80,70 +81,84 @@
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name="com.neko.v2ray.ui.MainActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:launchMode="singleTask" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name=".ui.ServerActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name=".ui.ServerCustomConfigActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.SettingsActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.PerAppProxyActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.ScannerActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.LogcatActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name=".ui.RoutingSettingsActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.SubSettingActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.UserAssetActivity" />
<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.UserAssetUrlActivity"
android:windowSoftInputMode="adjustPan" />

<activity
android:exported="false"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:screenOrientation="portrait"
android:name=".ui.SubEditActivity"
android:windowSoftInputMode="adjustPan" />
<activity
android:exported="false"
android:screenOrientation="portrait"
android:name=".ui.ScScannerActivity" />
<activity
android:exported="false"
android:name=".ui.ScSwitchActivity"
android:excludeFromRecents="true"
android:process=":RunSoLibV2RayDaemon"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar.Translucent" />

<activity
android:exported="true"
android:screenOrientation="portrait"
android:name=".ui.UrlSchemeActivity">
<intent-filter>
<action android:name="android.intent.action.SEND" />
Expand All @@ -163,35 +178,40 @@
</activity>
<activity
android:exported="false"
android:screenOrientation="portrait"
android:name=".ui.AboutActivity" />

<activity
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name="com.neko.v2ray.ui.CreditsActivity"
android:parentActivityName="com.neko.v2ray.ui.MainActivity"
android:screenOrientation="portrait"
android:exported="false" />

<activity
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name="com.neko.v2ray.ui.NekoAboutActivity"
android:parentActivityName="com.neko.v2ray.ui.MainActivity"
android:screenOrientation="portrait"
android:exported="false" />

<activity
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name="com.neko.v2ray.ui.NekoBackupActivity"
android:parentActivityName="com.neko.v2ray.ui.MainActivity"
android:screenOrientation="portrait"
android:exported="false" />

<activity
android:name="com.neko.tools.NetworkSwitcher"
android:screenOrientation="portrait"
android:exported="false" />

<activity
android:theme="@style/AppThemeDayNight.NoActionBar"
android:name="com.neko.tools.SpeedTestActivity"
android:exported="false"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:exported="false" />

<activity
android:theme="@style/AppThemeDayNight.NoActionBar"
Expand All @@ -216,8 +236,8 @@

<activity android:name="com.mikepenz.aboutlibraries.ui.LibsActivity"
android:theme="@style/AppThemeDayNight.NoActionBar"
android:exported="false"
android:screenOrientation="portrait" />
android:screenOrientation="portrait"
android:exported="false" />

<service
android:name=".service.V2RayVpnService"
Expand Down Expand Up @@ -287,6 +307,7 @@
<!-- =====================Tasker===================== -->
<activity
android:exported="true"
android:screenOrientation="portrait"
android:name=".ui.TaskerActivity"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/neko/v2ray/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,15 @@ class MainActivity : BaseActivity(), NavigationView.OnNavigationItemSelectedList
mainViewModel.isRunning.observe(this) { isRunning ->
adapter.isRunning = isRunning
if (isRunning) {
binding.fab.setImageResource(R.drawable.uwu_ic_service_busy)
binding.fab.setImageResource(R.drawable.ic_stop_24dp)
expandableConnection.expand()
expandableConnection.orientation = ExpandableView.HORIZONTAL
expandableConnection.setExpansion(true)
// binding.fab.backgroundTintList = ColorStateList.valueOf(ContextCompat.getColor(this, R.color.color_fab_orange))
setTestState(getString(R.string.connection_connected))
binding.layoutTest.isFocusable = true
} else {
binding.fab.setImageResource(R.drawable.uwu_ic_service_idle)
binding.fab.setImageResource(R.drawable.ic_play_24dp)
expandableConnection.collapse()
expandableConnection.orientation = ExpandableView.HORIZONTAL
expandableConnection.setExpansion(false)
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/color/uwu_accent_alpha.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="?colorPrimary"
android:color="?attr/colorThemeUwu"
android:alpha="0.3" />
</selector>
2 changes: 1 addition & 1 deletion app/src/main/res/color/uwu_accent_alpha1.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="?attr/colorPrimary"
android:color="?attr/colorThemeUwu"
android:alpha="0.4" />
</selector>
2 changes: 1 addition & 1 deletion app/src/main/res/color/uwu_switch_on_bg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
</selector>
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/round.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="?colorPrimary" />
<solid android:color="?attr/colorThemeUwu" />
<corners android:radius="500dp" />
</shape>
</item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/uwu_background_lengkung.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<shape
android:shape="rectangle">
<solid
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
</shape>
</item>
<item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<shape
android:shape="rectangle">
<solid
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
</shape>
</item>
<item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/uwu_background_material.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<shape
android:shape="rectangle">
<solid
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
</shape>
</item>
<item>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/uwu_bg_button.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<shape
android:shape="rectangle">
<solid
android:color="?colorPrimary" />
android:color="?attr/colorThemeUwu" />
<corners
android:topLeftRadius="14.0dip"
android:topRightRadius="14.0dip"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/uwu_bg_exit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<shape
android:shape="rectangle">
<solid
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
<corners
android:topLeftRadius="20.0dip"
android:topRightRadius="20.0dip"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/drawable/uwu_card_sin_accent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<solid
android:color="?attr/colorPrimary" />
android:color="?attr/colorThemeUwu" />
<corners
android:topLeftRadius="24.0dip"
android:topRightRadius="24.0dip"
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/uwu_dialog_singlechoice_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_checked="true"
android:drawable="@drawable/uwu_check" />
<item
android:drawable="@drawable/uwu_empty_singlechoice" />
</selector>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/uwu_empty_singlechoice.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:tint="?attr/colorControlNormal"
android:height="24.0dip"
android:width="24.0dip"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/transparent"
android:pathData="M9.55,18 L3.85,12.3 5.275,10.875 9.55,15.15 18.725,5.975 20.15,7.4Z" />
</vector>
8 changes: 4 additions & 4 deletions app/src/main/res/drawable/uwu_fluid_bg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
android:viewportHeight="200.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="?colorTertiary"
android:fillColor="?attr/colorTertiary"
android:pathData="M309.73,148.24Q181.53,158.45,86.22,145.39L210.35,176.17L309.73,148.24z"
android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:fillType="nonZero" />
<path
android:fillColor="?colorTertiaryContainer"
android:fillColor="?attr/colorTertiaryContainer"
android:pathData="M519.14,38.02Q446.42,115.38,263.49,154.64L517.49,120.23L519.14,38.02z"
android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:fillType="nonZero" />
<path
android:fillColor="?colorPrimaryInverse"
android:fillColor="?attr/colorPrimaryContainer"
android:pathData="M518.25,85.37C425.44,136.33,304.80,150.59,174.94,164.02L517.98,189.22L518.25,85.37z"
android:strokeLineCap="square"
android:strokeLineJoin="miter"
android:fillType="nonZero" />
<path
android:fillColor="?colorPrimary"
android:fillColor="?attr/colorThemeUwu"
android:pathData="M519.93,128.68C405.37,178.85,182.03,191.96,-22.01,112.43L-22.01,203.18L518.61,200.07L519.93,128.68z"
android:strokeLineCap="square"
android:strokeLineJoin="miter"
Expand Down
Loading

0 comments on commit 1fd88bb

Please sign in to comment.