ShiningRush commented on a change in pull request #947:
URL: https://github.com/apache/apisix-dashboard/pull/947#discussion_r533889484
##########
File path: api/internal/utils/utils.go
##########
@@ -37,10 +38,13 @@ func init() {
}
salt = uint16(i)
}
-
+ ips, err := getLocalIPs()
+ if err != nil {
+ panic(err)
+ }
_sf = sonyflake.NewSonyflake(sonyflake.Settings{
MachineID: func() (u uint16, e error) {
- return sumIP(GetOutboundIP()) + salt, nil
+ return sumIP(randomIP(ips)) + salt, nil
Review comment:
Here is a risk that different instance may be get the same IP in
multiple network environment (such as virtual network ), calculating all IP
would be better when we can not confirm which is physical network interface.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]