mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	attempt to convert old multicast listen regexps into new struct format
This commit is contained in:
		
							parent
							
								
									2874ce1327
								
							
						
					
					
						commit
						a42b77db84
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -96,6 +96,24 @@ func readConfig(log *log.Logger, useconf *bool, useconffile *string, normaliseco
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						if oldmc, ok := dat["MulticastInterfaces"]; ok {
 | 
				
			||||||
 | 
							fmt.Println("DEBUG:", oldmc)
 | 
				
			||||||
 | 
							if oldmcvals, ok := oldmc.([]interface{}); ok {
 | 
				
			||||||
 | 
								var newmc []config.MulticastInterfaceConfig
 | 
				
			||||||
 | 
								for _, oldmcval := range oldmcvals {
 | 
				
			||||||
 | 
									if str, ok := oldmcval.(string); ok {
 | 
				
			||||||
 | 
										newmc = append(newmc, config.MulticastInterfaceConfig{
 | 
				
			||||||
 | 
											Regex:    str,
 | 
				
			||||||
 | 
											Incoming: true,
 | 
				
			||||||
 | 
											Outgoing: true,
 | 
				
			||||||
 | 
										})
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if newmc != nil {
 | 
				
			||||||
 | 
									dat["MulticastInterfaces"] = newmc
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	// Sanitise the config
 | 
						// Sanitise the config
 | 
				
			||||||
	confJson, err := json.Marshal(dat)
 | 
						confJson, err := json.Marshal(dat)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue