mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-12-22 23:57:26 +08:00
feat: tuic outbound allow set an empty ALPN
array
This commit is contained in:
parent
f73f32e41c
commit
9cbca162a0
@ -162,7 +162,7 @@ func NewTuic(option TuicOption) (*Tuic, error) {
|
||||
tlsConfig = tlsC.GetGlobalTLSConfig(tlsConfig)
|
||||
}
|
||||
|
||||
if len(option.ALPN) > 0 {
|
||||
if option.ALPN != nil { // structure's Decode will ensure value not nil when input has value even it was set an empty array
|
||||
tlsConfig.NextProtos = option.ALPN
|
||||
} else {
|
||||
tlsConfig.NextProtos = []string{"h3"}
|
||||
|
@ -282,6 +282,9 @@ func (d *Decoder) decodeSlice(name string, data any, val reflect.Value) error {
|
||||
}
|
||||
|
||||
valSlice := val
|
||||
// make a new slice with cap(val)==cap(dataVal)
|
||||
// the caller can determine whether the original configuration contains this item by judging whether the value is nil.
|
||||
valSlice = reflect.MakeSlice(valType, 0, dataVal.Len())
|
||||
for i := 0; i < dataVal.Len(); i++ {
|
||||
currentData := dataVal.Index(i).Interface()
|
||||
for valSlice.Len() <= i {
|
||||
|
Loading…
Reference in New Issue
Block a user