Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c9c9b5a4c | ||
|
|
e13024d6bb | ||
|
|
9d58edd31f | ||
|
|
af7dfc3a43 | ||
|
|
ca554e6ac4 | ||
|
|
ec391d8689 |
@@ -24,7 +24,6 @@ type resolved struct {
|
||||
domain string
|
||||
IPs []net.IP
|
||||
Port int
|
||||
lastResolved time.Time
|
||||
ipIdx uint8
|
||||
ipLock sync.Mutex
|
||||
lastSwitched time.Time
|
||||
@@ -98,7 +97,7 @@ func (d *ProtectedDialer) PrepareResolveChan() {
|
||||
d.resolveChan = make(chan struct{})
|
||||
}
|
||||
|
||||
func (d *ProtectedDialer) ResolveChan() chan struct{} {
|
||||
func (d *ProtectedDialer) ResolveChan() <-chan struct{} {
|
||||
return d.resolveChan
|
||||
}
|
||||
|
||||
@@ -138,10 +137,9 @@ func (d *ProtectedDialer) lookupAddr(addr string) (*resolved, error) {
|
||||
}
|
||||
|
||||
rs := &resolved{
|
||||
domain: host,
|
||||
IPs: IPs,
|
||||
Port: portnum,
|
||||
lastResolved: time.Now(),
|
||||
domain: host,
|
||||
IPs: IPs,
|
||||
Port: portnum,
|
||||
}
|
||||
|
||||
return rs, nil
|
||||
@@ -152,6 +150,7 @@ func (d *ProtectedDialer) PrepareDomain(domainName string, closeCh <-chan struct
|
||||
log.Printf("Preparing Domain: %s", domainName)
|
||||
d.currentServer = domainName
|
||||
|
||||
defer close(d.resolveChan)
|
||||
maxRetry := 10
|
||||
for {
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -71,10 +71,7 @@ func (v *V2RayPoint) RunLoop() (err error) {
|
||||
if !v.status.IsRunning {
|
||||
v.closeChan = make(chan struct{})
|
||||
v.dialer.PrepareResolveChan()
|
||||
go func() {
|
||||
v.dialer.PrepareDomain(v.DomainName, v.closeChan)
|
||||
close(v.dialer.ResolveChan())
|
||||
}()
|
||||
go v.dialer.PrepareDomain(v.DomainName, v.closeChan)
|
||||
go func() {
|
||||
select {
|
||||
// wait until resolved
|
||||
|
||||
@@ -76,7 +76,10 @@
|
||||
|
||||
<activity android:name=".ui.SubEditActivity" />
|
||||
<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
|
||||
android:name=".service.V2RayVpnService"
|
||||
|
||||
@@ -384,6 +384,7 @@ class V2RayVpnService : VpnService() {
|
||||
mBuilder?.setSmallIcon(R.drawable.ic_stat_direct)
|
||||
}
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
<item name="windowNoTitle">true</item>
|
||||
</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.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||
|
||||
Reference in New Issue
Block a user