mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Ensure PublicKey is correct when extracting from old config
This commit is contained in:
		
							parent
							
								
									5cede61a34
								
							
						
					
					
						commit
						54cced0b89
					
				
					 1 changed files with 7 additions and 9 deletions
				
			
		| 
						 | 
					@ -82,17 +82,15 @@ func readConfig(log *log.Logger, useconf *bool, useconffile *string, normaliseco
 | 
				
			||||||
	if _, ok := dat["TunnelRouting"]; ok {
 | 
						if _, ok := dat["TunnelRouting"]; ok {
 | 
				
			||||||
		log.Warnln("WARNING: Tunnel routing is no longer supported")
 | 
							log.Warnln("WARNING: Tunnel routing is no longer supported")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if _, ok := dat["SigningPrivateKey"]; ok {
 | 
						if old, ok := dat["SigningPrivateKey"]; ok {
 | 
				
			||||||
		log.Warnln("WARNING: The configuration file is out of date, please take a backup and then use -normaliseconf")
 | 
					 | 
				
			||||||
		log.Warnln("WARNING: The \"SigningPrivateKey\" configuration option has been renamed to \"PrivateKey\"")
 | 
							log.Warnln("WARNING: The \"SigningPrivateKey\" configuration option has been renamed to \"PrivateKey\"")
 | 
				
			||||||
		if _, ok := dat["PrivateKey"]; !ok {
 | 
							if _, ok := dat["PrivateKey"]; !ok {
 | 
				
			||||||
			dat["PrivateKey"] = dat["SigningPrivateKey"]
 | 
								if privstr, err := hex.DecodeString(old.(string)); err == nil {
 | 
				
			||||||
		}
 | 
									priv := ed25519.PrivateKey(privstr)
 | 
				
			||||||
	}
 | 
									pub := priv.Public().(ed25519.PublicKey)
 | 
				
			||||||
	if _, ok := dat["SigningPublicKey"]; ok {
 | 
									dat["PrivateKey"] = hex.EncodeToString(priv[:])
 | 
				
			||||||
		log.Warnln("WARNING: The \"SigningPrivateKey\" configuration option has been renamed to \"PrivateKey\"")
 | 
									dat["PublicKey"] = hex.EncodeToString(pub[:])
 | 
				
			||||||
		if _, ok := dat["PublicKey"]; !ok {
 | 
								}
 | 
				
			||||||
			dat["PublicKey"] = dat["SigningPublicKey"]
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	// Sanitise the config
 | 
						// Sanitise the config
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue