mirror of
https://github.com/SagerNet/sing-tun.git
synced 2025-04-04 04:17:39 +03:00
Remove unused ICMP replies & Improve tcpbuf options
This commit is contained in:
parent
24206c3edd
commit
a5cb9f4f5f
7 changed files with 122 additions and 289 deletions
10
tun_linux.go
10
tun_linux.go
|
@ -224,7 +224,6 @@ func open(name string, vnetHdr bool) (int, error) {
|
|||
func (t *NativeTun) configure(tunLink netlink.Link) error {
|
||||
err := netlink.LinkSetMTU(tunLink, int(t.options.MTU))
|
||||
if errors.Is(err, unix.EPERM) {
|
||||
// unprivileged
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
|
@ -293,16 +292,17 @@ func (t *NativeTun) configure(tunLink netlink.Link) error {
|
|||
}
|
||||
|
||||
func (t *NativeTun) Start() error {
|
||||
if t.options.FileDescriptor != 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
tunLink, err := netlink.LinkByName(t.options.Name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = netlink.LinkSetUp(tunLink)
|
||||
if errors.Is(err, unix.EPERM) {
|
||||
// unprivileged
|
||||
return nil
|
||||
} else if err != nil {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue