mirror of
https://github.com/SagerNet/sing.git
synced 2025-04-05 21:07:41 +03:00
21 lines
434 B
Go
21 lines
434 B
Go
package control
|
|
|
|
import (
|
|
"syscall"
|
|
)
|
|
|
|
type Func = func(network, address string, conn syscall.RawConn) error
|
|
|
|
func Append(oldFunc Func, newFunc Func) Func {
|
|
if oldFunc == nil {
|
|
return newFunc
|
|
} else if newFunc == nil {
|
|
return oldFunc
|
|
}
|
|
return func(network, address string, conn syscall.RawConn) error {
|
|
if err := oldFunc(network, address, conn); err != nil {
|
|
return err
|
|
}
|
|
return newFunc(network, address, conn)
|
|
}
|
|
}
|