@@ -42,8 +42,8 @@ func (plugin *PluginDNS64) Init(proxy *Proxy) error {
4242 plugin .proxy = proxy
4343
4444 if len (proxy .dns64Prefixes ) != 0 {
45- plugin .pref64Mutex .RLock ()
46- defer plugin .pref64Mutex .RUnlock ()
45+ plugin .pref64Mutex .Lock ()
46+ defer plugin .pref64Mutex .Unlock ()
4747 for _ , prefStr := range proxy .dns64Prefixes {
4848 _ , pref , err := net .ParseCIDR (prefStr )
4949 if err != nil {
@@ -132,7 +132,7 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
132132
133133 ipv4 := answer .(* dns.A ).A .To4 ()
134134 if ipv4 != nil {
135- plugin .pref64Mutex .Lock ()
135+ plugin .pref64Mutex .RLock ()
136136 for _ , prefix := range plugin .pref64 {
137137 ipv6 := translateToIPv6 (ipv4 , prefix )
138138 synthAAAA := new (dns.AAAA )
@@ -145,7 +145,7 @@ func (plugin *PluginDNS64) Eval(pluginsState *PluginsState, msg *dns.Msg) error
145145 synthAAAA .AAAA = ipv6
146146 synthAAAAs = append (synthAAAAs , synthAAAA )
147147 }
148- plugin .pref64Mutex .Unlock ()
148+ plugin .pref64Mutex .RUnlock ()
149149 }
150150 }
151151 }
@@ -239,8 +239,8 @@ func (plugin *PluginDNS64) fetchPref64(resolver string) error {
239239 return errors .New ("Empty Pref64 list" )
240240 }
241241
242- plugin .pref64Mutex .RLock ()
243- defer plugin .pref64Mutex .RUnlock ()
242+ plugin .pref64Mutex .Lock ()
243+ defer plugin .pref64Mutex .Unlock ()
244244 plugin .pref64 = prefixes
245245 return nil
246246}
@@ -252,8 +252,8 @@ func (plugin *PluginDNS64) refreshPref64() error {
252252 }
253253 }
254254
255- plugin .pref64Mutex .Lock ()
256- defer plugin .pref64Mutex .Unlock ()
255+ plugin .pref64Mutex .RLock ()
256+ defer plugin .pref64Mutex .RUnlock ()
257257 if len (plugin .pref64 ) == 0 {
258258 return errors .New ("Empty Pref64 list" )
259259 }
0 commit comments