Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c9c9b5a4c | |||
| e13024d6bb | |||
| 9d58edd31f | |||
| af7dfc3a43 | |||
| ca554e6ac4 | |||
| ec391d8689 |
@@ -24,7 +24,6 @@ type resolved struct {
|
|||||||
domain string
|
domain string
|
||||||
IPs []net.IP
|
IPs []net.IP
|
||||||
Port int
|
Port int
|
||||||
lastResolved time.Time
|
|
||||||
ipIdx uint8
|
ipIdx uint8
|
||||||
ipLock sync.Mutex
|
ipLock sync.Mutex
|
||||||
lastSwitched time.Time
|
lastSwitched time.Time
|
||||||
@@ -98,7 +97,7 @@ func (d *ProtectedDialer) PrepareResolveChan() {
|
|||||||
d.resolveChan = make(chan struct{})
|
d.resolveChan = make(chan struct{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *ProtectedDialer) ResolveChan() chan struct{} {
|
func (d *ProtectedDialer) ResolveChan() <-chan struct{} {
|
||||||
return d.resolveChan
|
return d.resolveChan
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,10 +137,9 @@ func (d *ProtectedDialer) lookupAddr(addr string) (*resolved, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rs := &resolved{
|
rs := &resolved{
|
||||||
domain: host,
|
domain: host,
|
||||||
IPs: IPs,
|
IPs: IPs,
|
||||||
Port: portnum,
|
Port: portnum,
|
||||||
lastResolved: time.Now(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rs, nil
|
return rs, nil
|
||||||
@@ -152,6 +150,7 @@ func (d *ProtectedDialer) PrepareDomain(domainName string, closeCh <-chan struct
|
|||||||
log.Printf("Preparing Domain: %s", domainName)
|
log.Printf("Preparing Domain: %s", domainName)
|
||||||
d.currentServer = domainName
|
d.currentServer = domainName
|
||||||
|
|
||||||
|
defer close(d.resolveChan)
|
||||||
maxRetry := 10
|
maxRetry := 10
|
||||||
for {
|
for {
|
||||||
if maxRetry == 0 {
|
if maxRetry == 0 {
|
||||||
@@ -213,10 +212,6 @@ func (d *ProtectedDialer) Dial(ctx context.Context,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if time.Now().Sub(d.vServer.lastResolved) > time.Minute * 30 {
|
|
||||||
d.PrepareDomain(Address, nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
fd, err := d.getFd(dest.Network)
|
fd, err := d.getFd(dest.Network)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -71,10 +71,7 @@ func (v *V2RayPoint) RunLoop() (err error) {
|
|||||||
if !v.status.IsRunning {
|
if !v.status.IsRunning {
|
||||||
v.closeChan = make(chan struct{})
|
v.closeChan = make(chan struct{})
|
||||||
v.dialer.PrepareResolveChan()
|
v.dialer.PrepareResolveChan()
|
||||||
go func() {
|
go v.dialer.PrepareDomain(v.DomainName, v.closeChan)
|
||||||
v.dialer.PrepareDomain(v.DomainName, v.closeChan)
|
|
||||||
close(v.dialer.ResolveChan())
|
|
||||||
}()
|
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
// wait until resolved
|
// wait until resolved
|
||||||
|
|||||||
@@ -76,7 +76,10 @@
|
|||||||
|
|
||||||
<activity android:name=".ui.SubEditActivity" />
|
<activity android:name=".ui.SubEditActivity" />
|
||||||
<activity android:name=".ui.ScScannerActivity" />
|
<activity android:name=".ui.ScScannerActivity" />
|
||||||
<activity android:name=".ui.ScSwitchActivity" />
|
<activity
|
||||||
|
android:name=".ui.ScSwitchActivity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:theme="@style/AppTheme.NoActionBar.Translucent" />
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name=".service.V2RayVpnService"
|
android:name=".service.V2RayVpnService"
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ class V2RayVpnService : VpnService() {
|
|||||||
mBuilder?.setSmallIcon(R.drawable.ic_stat_direct)
|
mBuilder?.setSmallIcon(R.drawable.ic_stat_direct)
|
||||||
}
|
}
|
||||||
mBuilder?.setStyle(NotificationCompat.BigTextStyle().bigText(contentText))
|
mBuilder?.setStyle(NotificationCompat.BigTextStyle().bigText(contentText))
|
||||||
|
mBuilder?.setContentText(contentText) // Emui4.1 need content text even if style is set as BigTextStyle
|
||||||
getNotificationManager().notify(NOTIFICATION_ID, mBuilder?.build())
|
getNotificationManager().notify(NOTIFICATION_ID, mBuilder?.build())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,12 @@
|
|||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.NoActionBar.Translucent">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|||||||
Reference in New Issue
Block a user