mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 13:04:37 +03:00
Add more shortcut
This commit is contained in:
@@ -30,6 +30,7 @@ func UrlTest(client *http.Client, link string, timeout int32) (int32, error) {
|
|||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Millisecond)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Millisecond)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, "GET", link, nil)
|
req, err := http.NewRequestWithContext(ctx, "GET", link, nil)
|
||||||
req.Header.Set("User-Agent", fmt.Sprintf("curl/7.%d.%d", rand.Int()%84, rand.Int()%2))
|
req.Header.Set("User-Agent", fmt.Sprintf("curl/7.%d.%d", rand.Int()%84, rand.Int()%2))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -53,17 +54,8 @@ func UrlTest(client *http.Client, link string, timeout int32) (int32, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TcpPing(address string, timeout int32) (ms int32, err error) {
|
func TcpPing(address string, timeout int32) (ms int32, err error) {
|
||||||
host, port, err := net.SplitHostPort(address)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ip, err := net.ResolveIPAddr("ip", host)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//
|
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
c, err := net.DialTimeout("tcp", net.JoinHostPort(ip.String(), port), time.Duration(timeout)*time.Millisecond)
|
c, err := net.DialTimeout("tcp", address, time.Duration(timeout)*time.Millisecond)
|
||||||
endTime := time.Now()
|
endTime := time.Now()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
ms = int32(endTime.Sub(startTime).Milliseconds())
|
ms = int32(endTime.Sub(startTime).Milliseconds())
|
||||||
|
|||||||
@@ -711,6 +711,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove Duplicates</string>
|
<string>Remove Duplicates</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true">Ctrl+Shift+D</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionfake">
|
<action name="actionfake">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -756,6 +759,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Remove Unavailable</string>
|
<string>Remove Unavailable</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true">Ctrl+Shift+R</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_full_test">
|
<action name="menu_full_test">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -838,6 +844,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Resolve domain</string>
|
<string>Resolve domain</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string notr="true">Ctrl+Shift+I</string>
|
||||||
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_vpn_settings">
|
<action name="menu_vpn_settings">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
|||||||
Reference in New Issue
Block a user