mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-10 11:00:28 +00:00
Merge pull request #473 from Arceliar/macos
Possible fix for macos self-traffic
This commit is contained in:
commit
39245f8134
@ -17,6 +17,7 @@ jobs:
|
|||||||
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
|
echo 'export CINAME=$(sh contrib/semver/name.sh)' >> $BASH_ENV
|
||||||
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
|
echo 'export CIVERSION=$(sh contrib/semver/version.sh --bare)' >> $BASH_ENV
|
||||||
echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV
|
echo 'export CIVERSIONRPM=$(sh contrib/semver/version.sh --bare | tr "-" ".")' >> $BASH_ENV
|
||||||
|
echo 'export CIBRANCH=$(echo $CIRCLE_BRANCH | tr -d "/")' >> $BASH_ENV
|
||||||
case "$CINAME" in \
|
case "$CINAME" in \
|
||||||
"yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \
|
"yggdrasil") (echo 'export CICONFLICTS=yggdrasil-develop' >> $BASH_ENV) ;; \
|
||||||
"yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \
|
"yggdrasil-develop") (echo 'export CICONFLICTS=yggdrasil' >> $BASH_ENV) ;; \
|
||||||
@ -31,11 +32,11 @@ jobs:
|
|||||||
sudo apt-get install -y rpm file
|
sudo apt-get install -y rpm file
|
||||||
mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
|
mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
|
||||||
|
|
||||||
# - run:
|
- run:
|
||||||
# name: Test debug builds
|
name: Test debug builds
|
||||||
# command: |
|
command: |
|
||||||
# ./build -d
|
./build -d
|
||||||
# test -f yggdrasil && test -f yggdrasilctl
|
test -f yggdrasil && test -f yggdrasilctl
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Build for Linux (including Debian packages)
|
name: Build for Linux (including Debian packages)
|
||||||
@ -53,9 +54,9 @@ jobs:
|
|||||||
name: Build for Linux (RPM packages)
|
name: Build for Linux (RPM packages)
|
||||||
command: |
|
command: |
|
||||||
git clone https://github.com/yggdrasil-network/yggdrasil-package-rpm ~/rpmbuild/SPECS
|
git clone https://github.com/yggdrasil-network/yggdrasil-package-rpm ~/rpmbuild/SPECS
|
||||||
cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIRCLE_BRANCH-$CIVERSIONRPM/" project
|
cd ../ && tar -czvf ~/rpmbuild/SOURCES/v$CIVERSIONRPM --transform "s/project/yggdrasil-go-$CIBRANCH-$CIVERSIONRPM/" project
|
||||||
sed -i "s/yggdrasil-go/yggdrasil-go-$CIRCLE_BRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
sed -i "s/yggdrasil-go/yggdrasil-go-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
||||||
sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIRCLE_BRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
sed -i "s/^PKGNAME=yggdrasil/PKGNAME=yggdrasil-$CIBRANCH/" ~/rpmbuild/SPECS/yggdrasil.spec
|
||||||
sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/yggdrasil.spec
|
sed -i "s/^Name\:.*/Name\: $CINAME/" ~/rpmbuild/SPECS/yggdrasil.spec
|
||||||
sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/yggdrasil.spec
|
sed -i "s/^Version\:.*/Version\: $CIVERSIONRPM/" ~/rpmbuild/SPECS/yggdrasil.spec
|
||||||
sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/yggdrasil.spec
|
sed -i "s/^Conflicts\:.*/Conflicts\: $CICONFLICTS/" ~/rpmbuild/SPECS/yggdrasil.spec
|
||||||
@ -101,11 +102,11 @@ jobs:
|
|||||||
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: Install Go 1.12
|
name: Install Go 1.12.7
|
||||||
command: |
|
command: |
|
||||||
cd /tmp
|
cd /tmp
|
||||||
curl -LO https://dl.google.com/go/go1.12.darwin-amd64.pkg
|
curl -LO https://dl.google.com/go/go1.12.7.darwin-amd64.pkg
|
||||||
sudo installer -pkg /tmp/go1.12.darwin-amd64.pkg -target /
|
sudo installer -pkg /tmp/go1.12.7.darwin-amd64.pkg -target /
|
||||||
|
|
||||||
#- run:
|
#- run:
|
||||||
# name: Install Gomobile
|
# name: Install Gomobile
|
||||||
|
@ -30,7 +30,12 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
|
|||||||
return tun.setupAddress(addr)
|
return tun.setupAddress(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
const darwin_SIOCAIFADDR_IN6 = 2155899162
|
const (
|
||||||
|
darwin_SIOCAIFADDR_IN6 = 2155899162 // netinet6/in6_var.h
|
||||||
|
darwin_IN6_IFF_NODAD = 0x0020 // netinet6/in6_var.h
|
||||||
|
darwin_IN6_IFF_SECURED = 0x0400 // netinet6/in6_var.h
|
||||||
|
darwin_ND6_INFINITE_LIFETIME = 0xFFFFFFFF // netinet6/nd6.h
|
||||||
|
)
|
||||||
|
|
||||||
type in6_addrlifetime struct {
|
type in6_addrlifetime struct {
|
||||||
ia6t_expire float64
|
ia6t_expire float64
|
||||||
@ -91,8 +96,11 @@ func (tun *TunAdapter) setupAddress(addr string) error {
|
|||||||
ar.ifra_addr.sin6_addr[i] = uint16(binary.BigEndian.Uint16(b))
|
ar.ifra_addr.sin6_addr[i] = uint16(binary.BigEndian.Uint16(b))
|
||||||
}
|
}
|
||||||
|
|
||||||
ar.ifra_lifetime.ia6t_vltime = 0xFFFFFFFF
|
ar.ifra_flags |= darwin_IN6_IFF_NODAD
|
||||||
ar.ifra_lifetime.ia6t_pltime = 0xFFFFFFFF
|
ar.ifra_flags |= darwin_IN6_IFF_SECURED
|
||||||
|
|
||||||
|
ar.ifra_lifetime.ia6t_vltime = darwin_ND6_INFINITE_LIFETIME
|
||||||
|
ar.ifra_lifetime.ia6t_pltime = darwin_ND6_INFINITE_LIFETIME
|
||||||
|
|
||||||
var ir ifreq
|
var ir ifreq
|
||||||
copy(ir.ifr_name[:], tun.iface.Name())
|
copy(ir.ifr_name[:], tun.iface.Name())
|
||||||
|
@ -179,8 +179,12 @@ func (sinfo *searchInfo) continueSearch() {
|
|||||||
// Calls create search, and initializes the iterative search parts of the struct before returning it.
|
// Calls create search, and initializes the iterative search parts of the struct before returning it.
|
||||||
func (s *searches) newIterSearch(dest *crypto.NodeID, mask *crypto.NodeID, callback func(*sessionInfo, error)) *searchInfo {
|
func (s *searches) newIterSearch(dest *crypto.NodeID, mask *crypto.NodeID, callback func(*sessionInfo, error)) *searchInfo {
|
||||||
sinfo := s.createSearch(dest, mask, callback)
|
sinfo := s.createSearch(dest, mask, callback)
|
||||||
sinfo.toVisit = s.core.dht.lookup(dest, true)
|
|
||||||
sinfo.visited = make(map[crypto.NodeID]bool)
|
sinfo.visited = make(map[crypto.NodeID]bool)
|
||||||
|
loc := s.core.switchTable.getLocator()
|
||||||
|
sinfo.toVisit = append(sinfo.toVisit, &dhtInfo{
|
||||||
|
key: s.core.boxPub,
|
||||||
|
coords: loc.getCoords(),
|
||||||
|
}) // Start the search by asking ourself, useful if we're the destination
|
||||||
return sinfo
|
return sinfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user