mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-07 17:51:16 +08:00
Fix: error when proxy or device empty
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package engine
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/component/dialer"
|
"github.com/xjasonlyu/tun2socks/component/dialer"
|
||||||
"github.com/xjasonlyu/tun2socks/device"
|
"github.com/xjasonlyu/tun2socks/device"
|
||||||
"github.com/xjasonlyu/tun2socks/log"
|
"github.com/xjasonlyu/tun2socks/log"
|
||||||
@@ -84,6 +86,10 @@ func (e *Engine) setStats() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) setProxy() error {
|
func (e *Engine) setProxy() error {
|
||||||
|
if e.rawProxy == "" {
|
||||||
|
return errors.New("empty proxy")
|
||||||
|
}
|
||||||
|
|
||||||
d, err := parseProxy(e.rawProxy)
|
d, err := parseProxy(e.rawProxy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -93,6 +99,10 @@ func (e *Engine) setProxy() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (e *Engine) setDevice() error {
|
func (e *Engine) setDevice() error {
|
||||||
|
if e.rawDevice == "" {
|
||||||
|
return errors.New("empty device")
|
||||||
|
}
|
||||||
|
|
||||||
d, err := parseDevice(e.rawDevice, e.mtu)
|
d, err := parseDevice(e.rawDevice, e.mtu)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Reference in New Issue
Block a user