functions.go 385 B

12345678910111213141516
  1. package core
  2. import (
  3. "context"
  4. "v2ray.com/core/common"
  5. )
  6. // CreateObject creates a new object based on the given V2Ray instance and config. The V2Ray instance may be nil.
  7. func CreateObject(v *Instance, config interface{}) (interface{}, error) {
  8. ctx := context.Background()
  9. if v != nil {
  10. ctx = context.WithValue(ctx, v2rayKey, v)
  11. }
  12. return common.CreateObject(ctx, config)
  13. }