Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
26beb8f
Change to embedding official IPFS binary instead of recreating a node
donovansolms May 29, 2019
739ed74
Cleaning house for new implementation
donovansolms Jun 18, 2019
9285226
Add back ZeroNet
donovansolms Jun 18, 2019
37a8bf1
Add new IPFS package
donovansolms Jun 18, 2019
40fcd82
Initial working runnable using ZeroNet and IPFS
donovansolms Jun 19, 2019
e802632
Working C library example
donovansolms Jun 20, 2019
da97d43
Added example output
donovansolms Jun 20, 2019
3cd9425
Added packaging of IPFS to Makefile for Windows
donovansolms Jun 25, 2019
48db29a
Added Windows and MacOS IPFS binaries
donovansolms Jun 26, 2019
a9b38bd
Added MacOS builds to Makefile
donovansolms Jun 26, 2019
108b05b
Update libznipfs
hayzamjs Jan 8, 2020
e6b1886
Use server profile and folder name change
hayzamjs Oct 2, 2020
9862f7c
Add arguments separately
hayzamjs Oct 3, 2020
bc1e7a2
Add new calls, update example
hayzamjs Oct 4, 2020
c70c43f
Update LICENSE
hayzamjs Oct 4, 2020
9db4b19
Fix name from libznipfs to libipfs
hayzamjs Nov 6, 2020
f2e1394
Modified stop function, usage script
hayzamjs Nov 6, 2020
260cde0
Add publish to IPNS function
hayzamjs Nov 10, 2020
35f0455
Add pubsub for faster IPNS
hayzamjs Dec 22, 2020
093364e
change usage.cpp to older
hayzamjs Dec 22, 2020
aac893a
Add module stuff
hayzamjs Feb 18, 2021
9071515
Different ports, startup dance, Cat command
hayzamjs Feb 19, 2021
fe133b7
Update readme with needed go modules, start adding CI/CD
hayzamjs May 5, 2021
333efc5
Run apt commands with sudo in actions
hayzamjs May 5, 2021
824096f
Refactor CI code, add windows build instructions as well
hayzamjs May 5, 2021
a70169d
Fix indendation
hayzamjs May 5, 2021
e7d3788
More fixes for yaml
hayzamjs May 5, 2021
0dc192b
Add macOS to CI
hayzamjs May 5, 2021
56f9b9a
Merge pull request #1 from scala-network/CI/CD
hayzamjs May 5, 2021
5c75be0
Add CI-build badge
hayzamjs May 5, 2021
15aec60
CD integration first pass
hayzamjs May 6, 2021
c73a3c3
Use matrix for os's
hayzamjs May 6, 2021
1bfb9de
Fix CD script
hayzamjs May 6, 2021
529a994
Step checkout before creating release
hayzamjs May 6, 2021
28d7dea
Better platform handling
hayzamjs May 6, 2021
7f46f60
Fix if clauses
hayzamjs May 6, 2021
ad8aff8
Better release stuff
hayzamjs May 6, 2021
9d8d7cd
Fix YAML
hayzamjs May 6, 2021
63a6184
Remove windows release for now
hayzamjs May 6, 2021
3e0bff3
Better upload_url handling
hayzamjs May 7, 2021
59ea66b
Add needs to publishing release job
hayzamjs May 7, 2021
6c420d3
Use windows-latest for windows build
hayzamjs May 7, 2021
d659427
Install go manually for windows-latest
hayzamjs May 7, 2021
7acb7cd
Log path
hayzamjs May 7, 2021
a3e8325
Use ubuntu-18.04 instead of windows-latest for windows build
hayzamjs May 7, 2021
2b2ea8f
Finalize CI/CD stuff
hayzamjs May 7, 2021
9ca5f20
Update build-ci.yml
hayzamjs May 9, 2021
7c5ee9a
Downgrade go version for macOS builds
hayzamjs May 28, 2021
ec46a67
Fix YAML in build-cd.yml
hayzamjs May 28, 2021
4c095de
Update build-cd.yml
hayzamjs May 29, 2021
b799b43
Update CHANGELOG.md
hayzamjs May 29, 2021
1188d7c
Use go-ipfs as a library instead of embedding executable
hayzamjs Jul 18, 2021
b2111fe
CI: Use 1.16 for macOS builds as well
hayzamjs Jul 18, 2021
cf34fc4
Add CD actions script
Aug 21, 2021
7f263bd
Update version, add changelog
hayzamjs Aug 21, 2021
128eb04
Add CD for windows and linux
hayzamjs Aug 21, 2021
33a9557
Merge pull request #2 from scala-network/v2.0
hayzamjs Aug 21, 2021
c3e7574
Use latest version of go-ipfs
hayzamjs Oct 4, 2021
dbe0fe4
Add v2.1.0 changelog
hayzamjs Oct 4, 2021
bb4f63d
Change how repo dirs are initialized
hayzamjs Oct 27, 2021
45b3c3b
update: dependencies, add more targets to makefile
hayzamjs May 2, 2023
21d3146
update: readme, new: pin and get pins funcs
hayzamjs Jul 31, 2023
c8dd194
update: dependencies
hayzamjs Jul 31, 2023
8546b0e
v3: update all dependencies, clean up code
hayzamjs Jan 18, 2025
2c5f897
ipfs: fix dir checks, tests: add ipfs/fs
hayzamjs Jan 29, 2025
466f256
update: dependencies versions
hayzamjs Apr 20, 2025
d46f035
version: bump to 3.0.1
hayzamjs Apr 20, 2025
eb7b7c9
mod: update
hayzamjs Apr 20, 2025
f2bb194
go.mod: tidy
hayzamjs Apr 20, 2025
1b1511f
actions: init, makefile: go build optimizations
hayzamjs Apr 20, 2025
4169320
actions: add release to job
hayzamjs Apr 20, 2025
fa93298
build: add CMakeLists.txt
hayzamjs Apr 23, 2025
f4a1680
cmakeL: macOS: libs
hayzamjs Apr 23, 2025
ce88bf4
cmake: scala specific stuff
hayzamjs Apr 24, 2025
2946f64
cmake: set CC flag on macOS only for depends build
hayzamjs Apr 25, 2025
58c5c86
cmake: use CROSS_CC only with depends
hayzamjs Apr 25, 2025
c3d4961
cmake: ranlib on darwin
hayzamjs Apr 25, 2025
7826c80
Bump github.com/quic-go/quic-go from 0.48.1 to 0.49.1
dependabot[bot] Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build and Release

on:
push: {}
pull_request: {}
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23.x'

- name: Install cross-compilation dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
gcc \
clang \
clang-tools \
g++-mingw-w64-x86-64 \
gcc-mingw-w64-x86-64 \
gcc-riscv64-linux-gnu \
g++-riscv64-linux-gnu \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
wget \
tar \
xz-utils \
software-properties-common \
aria2

- name: Install FreeBSD sysroot
run: |
sudo mkdir -p /usr/local/freebsd-sysroot
aria2c -x 4 https://download.freebsd.org/ftp/releases/amd64/13.4-RELEASE/base.txz
sudo tar -xJf base.txz -C /usr/local/freebsd-sysroot
rm base.txz

- name: Install osxcross for Darwin builds
run: |
sudo apt-get install -y \
clang \
cmake \
libxml2-dev \
uuid-dev \
libssl-dev \
zlib1g-dev \
libbz2-dev \
liblzma-dev

git clone https://github.com/tpoechtrager/osxcross.git
cd osxcross
wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
mv MacOSX11.3.sdk.tar.xz tarballs/
UNATTENDED=1 ./build.sh
echo "$(pwd)/target/bin" >> $GITHUB_PATH

- name: Run make
run: make

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: built-binaries
path: bin/
retention-days: 5

- name: Get tag version (if tag push)
if: startsWith(github.ref, 'refs/tags/')
id: get_version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_ENV

release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: built-binaries
path: bin

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.build.outputs.tag_version }}
name: Release ${{ needs.build.outputs.tag_version }}
body: |
## Pre-built binaries
- Static libraries (.a files)
- Header files (.h files)

Built from tag: ${{ needs.build.outputs.tag_version }}
files: |
bin/*.a
bin/*.h
generate_release_notes: true
draft: false
prerelease: false
19 changes: 4 additions & 15 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
/.project

# Build output
bin/
example/.libipfs-repo/
example/libipfs-*
example/test-download.jpg
.vscode/
148 changes: 148 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
cmake_minimum_required(VERSION 3.10)
project(libipfs_go)

if(APPLE)
set(GOOS "darwin")
find_library(SECURITY_FRAMEWORK Security REQUIRED)
find_library(RESOLV_LIBRARY resolv REQUIRED)
elseif(UNIX)
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(GOOS "freebsd")
else()
set(GOOS "linux")
endif()
elseif(WIN32)
set(GOOS "windows")
else()
message(FATAL_ERROR "Unsupported OS")
endif()

if(NOT DEFINED ARCH_ID)
message(FATAL_ERROR "ARCH_ID must be passed from parent")
endif()

if(DEFINED ARCH_ID)
message(STATUS "Using Scala ARCH_ID: ${ARCH_ID}")
set(GOARCH_FROM_ARCH_ID ON)
if(ARCH_ID STREQUAL "x86_64")
set(GOARCH "amd64")
elseif(ARCH_ID MATCHES "^(aarch64|arm64|armv8-a)$")
set(GOARCH "arm64")
elseif(ARCH_ID STREQUAL "riscv64")
set(GOARCH "riscv64")
else()
message("Unsupported ARCH_ID: ${ARCH_ID} DEFAULTING TO amd64")
set(GOARCH "amd64")
endif()
else()
message(STATUS "Deriving GOARCH from CMAKE_SYSTEM_PROCESSOR")
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSTEM_ARCH)
message(STATUS "Detected system arch: ${SYSTEM_ARCH}")

if(SYSTEM_ARCH STREQUAL "x86_64" OR SYSTEM_ARCH STREQUAL "amd64")
set(GOARCH "amd64")
elseif(SYSTEM_ARCH MATCHES "^(aarch64|arm64|armv8-a)$")
set(GOARCH "arm64")
elseif(SYSTEM_ARCH STREQUAL "riscv64")
set(GOARCH "riscv64")
else()
message(FATAL_ERROR "Unsupported system processor architecture: ${SYSTEM_ARCH}")
endif()
endif()

set(GO_OUT libipfs-${GOOS}-${GOARCH}.a)
set(GO_HEADER libipfs.h)

set(CROSS_CC "")

if(DEPENDS)
if(GOARCH STREQUAL "arm64")
set(CROSS_CC "CC=aarch64-linux-gnu-gcc")
endif()

if(GOARCH STREQUAL "riscv64")
set(CROSS_CC "CC=riscv64-linux-gnu-gcc")
endif()

if(GOOS STREQUAL "windows" AND CMAKE_C_PLATFORM_ID STREQUAL "MinGW")
set(CROSS_CC "CC=x86_64-w64-mingw32-gcc-posix")
endif()
endif()

if(APPLE)
if(DEFINED scala_BINARY_DIR AND NOT "${scala_BINARY_DIR}" STREQUAL "")
if(DEFINED CMAKE_OSX_SYSROOT)
if(DEPENDS)
set(CROSS_CC "CC=clang --target=${CLANG_TARGET} --sysroot=${CMAKE_OSX_SYSROOT}")
endif()
endif()
endif()
endif()

if(FREEBSD)
if(DEFINED scala_BINARY_DIR AND NOT "${scala_BINARY_DIR}" STREQUAL "")
foreach(path IN LISTS CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
if("${path}" MATCHES "(.*/native)/usr/lib")
set(FREEBSD_SYSROOT "${CMAKE_MATCH_1}")
break()
endif()
endforeach()

if(DEFINED FREEBSD_SYSROOT)
set(CROSS_CC "CC=clang --target=x86_64-unknown-freebsd --sysroot=${FREEBSD_SYSROOT}")
else()
message(FATAL_ERROR "Could not detect FreeBSD sysroot from CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES")
endif()
endif()
endif()

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${GO_OUT} ${CMAKE_CURRENT_BINARY_DIR}/${GO_HEADER}
COMMAND ${CMAKE_COMMAND} -E env
${CROSS_CC}
CGO_ENABLED=1
GOOS=${GOOS}
GOARCH=${GOARCH}
go build
-buildmode=c-archive
-trimpath
"-ldflags=-s -w"
-o ${CMAKE_CURRENT_BINARY_DIR}/${GO_OUT}
${CMAKE_CURRENT_SOURCE_DIR}/libipfs.go
${GO_EXTRA_COMMANDS}
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/libipfs-${GOOS}-${GOARCH}.h
${CMAKE_CURRENT_BINARY_DIR}/libipfs.h
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libipfs.go
COMMENT "Building Go IPFS library (${GOOS}/${GOARCH})"
)

add_custom_target(libipfs_build ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${GO_OUT}
)

add_library(libipfs STATIC IMPORTED GLOBAL)
set_target_properties(libipfs PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/${GO_OUT}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR}
)

if(APPLE AND DEPENDS)
add_custom_command(TARGET libipfs_build POST_BUILD
COMMAND ${CMAKE_RANLIB} ${CMAKE_CURRENT_BINARY_DIR}/${GO_OUT}
COMMENT "Running ranlib on Darwin archive to generate symbol table"
)
endif()

if(APPLE)
set_target_properties(libipfs PROPERTIES
INTERFACE_LINK_LIBRARIES "${SECURITY_FRAMEWORK};${RESOLV_LIBRARY}"
)
elseif(UNIX AND NOT FREEBSD)
set_target_properties(libipfs PROPERTIES
INTERFACE_LINK_LIBRARIES "resolv"
)
endif()

add_dependencies(libipfs libipfs_build)
30 changes: 6 additions & 24 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
BSD 3-Clause License
Copyright 2025 Haku Labs MTÜ

Copyright (c) 2018, Stellite
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading
Loading