fox0430 / nicoru Goto Github PK
View Code? Open in Web Editor NEWA container runtime written in Nim
License: MIT License
A container runtime written in Nim
License: MIT License
Looking though the code, it may make sense to define distinct
types for tags, image ids, etc. Something like:
let
Tag = distinct string
Repo = distinct string
Image = distinct string
ImagePath = distinct string
ImageId = distinct string
...
proc `/`(path: string, image: ImageId): ImagePath = ...
Using this pattern of creating distinct types of strings would be easy to use, but allow the compiler to catch cases where "oops, a tag was used when I meant an image". There's a lot of places where various string types could likely get mixed up!
Distinct types would also help prevent a lot of potential security risks by adding known safe internal types from user input strings. Not sure how much of an issue this is currently, but personally I prefer to prevent certain classes of issues where it''s difficult to know if user input strings have been properly sanitized. For example, the repoUrl = fmt"..."
type of things might need sanitizing using URLEncode (or the Nim equivalent) to prevent weird URL related issues (or just bugs...).
If you like the idea I might be able to create a PR for it at some point.
nimble install nicoru
sudo nicoru run archlinux
Expected: command run.
Actual:
$ sudo nicoru run archinux
httpclient.nim(865) newConnection
Error: unhandled exception: SSL support is not available. Cannot connect over SSL. Compile with -d:ssl to enable. [HttpRequestError]
My setup is Arch Linux on WSL2 on Windows 10.
$ sudo ./nicoru run nginx
Create container: 61af1e7679853bebdc373ac0
/home/fox/git/nicoru/src/nicoru.nim(8) nicoru
/home/fox/git/nicoru/src/pkgs/cmdparse.nim(388) checkArgments
/home/fox/git/nicoru/src/pkgs/cmdparse.nim(255) cmdRun
/home/fox/git/nicoru/src/pkgs/container.nim(565) runContainer
/home/fox/git/nicoru/src/pkgs/container.nim(371) execContainer
/home/fox/git/nicoru/src/pkgs/network.nim(728) initNicoruNetwork
/home/fox/git/nicoru/src/pkgs/network.nim(575) createBridge
/home/fox/.choosenim/toolchains/nim-1.6.0/lib/pure/options.nim(194) get
Error: unhandled exception: Can't obtain a value from a `none` [UnpackDefect]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.