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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user