```
type natmap struct {
sync.RWMutex
m map[string][]net.PacketConn
timeout time.Duration
}
func newNATmap(timeout time.Duration) *natmap {
m := &natmap{}
m.m = make(map[string][10]net.PacketConn)
log.Printf("%#v", m)
m.timeout = timeout
return m
}
```
m.m = make(map[string][10]net.PacketConn)
关键是这句,想在初始化的时候初始化一个10个空间的数组包含在字典里面,不然运行时报错超出数组长度.
求大佬帮忙
有疑问加站长微信联系(非本文作者)