Skip to content

Commit

Permalink
fix: disable ipv6 (#16)
Browse files Browse the repository at this point in the history
* fix: docker build for gobgp

* fix: disable ipv6
  • Loading branch information
chifu1234 authored Mar 24, 2022
1 parent c26fdcf commit 742cd5d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package main
import (
"bytes"
"context"
"encoding/binary"
"fmt"
"net"
"net/http"
"strings"
Expand Down Expand Up @@ -180,6 +182,10 @@ func getIP(ip string) (net.IPNet, error) {
if err != nil {
return net.IPNet{}, err
}
// only ipv4
if binary.Size(cidr.IP) == 16 {
return net.IPNet{}, fmt.Errorf("ipv6 %v", cidr.IP)
}
return *cidr, nil
}

Expand Down

0 comments on commit 742cd5d

Please sign in to comment.