Skip to content

Commit

Permalink
feat: expose serve function
Browse files Browse the repository at this point in the history
Signed-off-by: Norman Meier <norman@berty.tech>
  • Loading branch information
n0izn0iz committed Jan 29, 2022
1 parent f166213 commit 49bc7ca
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ios/Bridge/GomobileIPFS/Sources/IPFS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,26 @@ public class IPFS {
/// - Parameter onMultiaddr: The multiaddr to serve on
/// - Parameter writable: If true: will also support support `POST`, `PUT`, and `DELETE` methods.
/// - Throws: `NodeError`: If the node failed to serve
public func serveGateway(onMultiaddr: String, _ writable: Bool = false) throws -> String{
public func serveGateway(onMultiaddr: String, _ writable: Bool = false) throws -> String {
guard let node = self.node else {
throw IPFSError("unable to serve the gateway, is the node started?")
}

return try node.serveGateway(onMultiaddr: onMultiaddr, writable: writable)
}

/// Serves node opi over the given TCPPort
/// - Parameter onMultiaddr: The multiaddr to serve on
/// - Parameter writable: If true: will also support support `POST`, `PUT`, and `DELETE` methods.
/// - Throws: `NodeError`: If the node failed to serve
public func serve(onTCPPort: String) throws -> String {
guard let node = self.node else {
throw IPFSError("unable to serve the api, is the node started?")
}

return try node.serve(onTCPPort: onTCPPort)
}


/// Sets the primary and secondary DNS for gomobile (hacky, will be removed in future version)
/// - Parameters:
Expand Down

0 comments on commit 49bc7ca

Please sign in to comment.