mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 05:07:36 +03:00
19 lines
492 B
Go
19 lines
492 B
Go
package qtls
|
|
|
|
import "reflect"
|
|
|
|
func structsEqual(a, b interface{}) bool {
|
|
sa := reflect.ValueOf(a).Elem()
|
|
sb := reflect.ValueOf(b).Elem()
|
|
if sa.NumField() != sb.NumField() {
|
|
return false
|
|
}
|
|
for i := 0; i < sa.NumField(); i++ {
|
|
fa := sa.Type().Field(i)
|
|
fb := sb.Type().Field(i)
|
|
if !reflect.DeepEqual(fa.Index, fb.Index) || fa.Name != fb.Name || fa.Anonymous != fb.Anonymous || fa.Offset != fb.Offset || !reflect.DeepEqual(fa.Type, fb.Type) {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|