1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-02 07:25:19 -05:00

style: refine code style

This commit is contained in:
AkinoKaede
2023-05-28 14:32:48 +08:00
committed by Shelikhoo
parent 4276ee9464
commit 225d638338
4 changed files with 47 additions and 26 deletions

View File

@@ -11,7 +11,7 @@ import (
type StackOption func(*stack.Stack) error
func CreateStack(_ stack.LinkEndpoint) (*stack.Stack, error) {
func (t *TUN) CreateStack(_ stack.LinkEndpoint) (*stack.Stack, error) {
s := stack.New(stack.Options{
NetworkProtocols: []stack.NetworkProtocolFactory{
ipv4.NewProtocol,
@@ -25,6 +25,16 @@ func CreateStack(_ stack.LinkEndpoint) (*stack.Stack, error) {
},
})
opts := []StackOption{
SetTCPHandler(t.ctx, t.dispatcher, t.policyManager, t.config),
}
for _, opt := range opts {
if err := opt(s); err != nil {
return nil, err
}
}
// nicID := tcpip.NICID(s.UniqueID())
return s, nil