Skip to content

Commit 9023c61

Browse files
authored
Merge pull request #1 from pessoa736/dev
breaking my mind
2 parents 400fbbc + 5575ede commit 9023c61

12 files changed

Lines changed: 1321 additions & 187 deletions

File tree

.gitignore

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Compiled Lua sources
2+
luac.out
3+
4+
# luarocks build files
5+
*.src.rock
6+
*.zip
7+
*.tar.gz
8+
9+
# Object files
10+
*.o
11+
*.os
12+
*.ko
13+
*.obj
14+
*.elf
15+
16+
# Precompiled Headers
17+
*.gch
18+
*.pch
19+
20+
# Libraries
21+
*.lib
22+
*.a
23+
*.la
24+
*.lo
25+
*.def
26+
*.exp
27+
28+
# Shared objects (inc. Windows DLLs)
29+
*.dll
30+
*.so
31+
*.so.*
32+
*.dylib
33+
34+
# Executables
35+
*.exe
36+
*.out
37+
*.app
38+
*.i*86
39+
*.x86_64
40+
*.hex
41+
42+
# certicates
43+
44+
*.crt
45+
*.key

CONTRIBUTING.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributing to Pudim Server
2+
3+
Thank you for considering contributing to Pudim Server! 🎉
4+
5+
🇧🇷 [Leia em Português](CONTRIBUTING_PT-BR.MD)
6+
7+
## How to Contribute
8+
9+
### Reporting Bugs
10+
11+
1. Check if the bug hasn't already been reported in [issues](https://github.com/pessoa736/PudimServerAPIs/issues)
12+
2. If not found, create a new issue with:
13+
- Clear and descriptive title
14+
- Steps to reproduce the problem
15+
- Expected behavior vs actual behavior
16+
- Lua version and operating system
17+
- Example code (if possible)
18+
19+
### Suggesting Features
20+
21+
1. Check the [Roadmap](README.md#roadmap) to see if it's already planned
22+
2. Open an issue with the `feature request` tag
23+
3. Describe:
24+
- The problem the feature solves
25+
- How you imagine the API/usage
26+
- Code examples (if applicable)
27+
28+
### Submitting Pull Requests
29+
30+
1. **Fork** the repository
31+
2. **Clone** your fork:
32+
```sh
33+
git clone https://github.com/your-username/PudimServerAPIs.git
34+
cd PudimServerAPIs
35+
```
36+
3. Create a **branch** for your feature/fix:
37+
```sh
38+
git checkout -b my-feature
39+
```
40+
4. Make your changes
41+
5. **Test** your changes:
42+
```sh
43+
lua ./PS/mysandbox/test.lua
44+
```
45+
6. **Commit** your changes:
46+
```sh
47+
git add .
48+
git commit -m "feat: feature description"
49+
```
50+
7. **Push** to your fork:
51+
```sh
52+
git push origin my-feature
53+
```
54+
8. Open a **Pull Request** to the `dev` branch
55+
56+
## Code Conventions
57+
58+
### Style
59+
60+
- Indentation with **2 spaces**
61+
- Variable names in **camelCase**
62+
- Class/module names in **PascalCase**
63+
- Comments in Portuguese or English
64+
65+
### Commits
66+
67+
We follow the [Conventional Commits](https://www.conventionalcommits.org/) pattern:
68+
69+
| Type | Description |
70+
|------|-------------|
71+
| `feat` | New feature |
72+
| `fix` | Bug fix |
73+
| `docs` | Documentation changes |
74+
| `refactor` | Code refactoring |
75+
| `test` | Adding/modifying tests |
76+
| `chore` | Other changes (build, configs, etc) |
77+
78+
Examples:
79+
```
80+
feat: add query string support
81+
fix: fix header parsing with spaces
82+
docs: update README with new examples
83+
```
84+
85+
## Project Structure
86+
87+
```
88+
PudimServerAPIs/
89+
├── PS/ # Main source code
90+
│ ├── init.lua # Main module (PudimServer)
91+
│ ├── http.lua # HTTP parser and responses
92+
│ ├── utils.lua # Utilities and helpers
93+
│ ├── ServerChecks.lua # Server validations
94+
│ └── mysandbox/ # Tests and experiments
95+
├── rockspecs/ # LuaRocks specs
96+
├── README.md # Documentation in English
97+
├── README_PT-BR.MD # Documentation in Portuguese
98+
└── LICENSE # MIT License
99+
```
100+
101+
## Development Environment
102+
103+
### Requirements
104+
105+
- Lua >= 5.4
106+
- LuaRocks
107+
- LuaSocket
108+
- lua-cjson
109+
110+
### Local Installation
111+
112+
```sh
113+
# Install dependencies
114+
luarocks install luasocket --local
115+
luarocks install lua-cjson --local
116+
117+
# Run tests
118+
lua ./PS/mysandbox/test.lua
119+
```
120+
121+
## Questions?
122+
123+
Feel free to open an issue with the `question` tag or contact [Davi](https://github.com/pessoa736).
124+
125+
---
126+
127+
Thank you for contributing! 🍮

CONTRIBUTING_PT-BR.MD

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Contribuindo para o Pudim Server
2+
3+
Obrigado por considerar contribuir com o Pudim Server! 🎉
4+
5+
## Como contribuir
6+
7+
### Reportando bugs
8+
9+
1. Verifique se o bug já não foi reportado nas [issues](https://github.com/pessoa736/PudimServerAPIs/issues)
10+
2. Se não encontrar, crie uma nova issue com:
11+
- Título claro e descritivo
12+
- Passos para reproduzir o problema
13+
- Comportamento esperado vs comportamento atual
14+
- Versão do Lua e sistema operacional
15+
- Código de exemplo (se possível)
16+
17+
### Sugerindo features
18+
19+
1. Verifique o [Roadmap](README_PT-BR.MD#roadmap) para ver se já está planejado
20+
2. Abra uma issue com a tag `feature request`
21+
3. Descreva:
22+
- O problema que a feature resolve
23+
- Como você imagina a API/uso
24+
- Exemplos de código (se aplicável)
25+
26+
### Enviando Pull Requests
27+
28+
1. **Fork** o repositório
29+
2. **Clone** seu fork:
30+
```sh
31+
git clone https://github.com/seu-usuario/PudimServerAPIs.git
32+
cd PudimServerAPIs
33+
```
34+
3. Crie uma **branch** para sua feature/fix:
35+
```sh
36+
git checkout -b minha-feature
37+
```
38+
4. Faça suas alterações
39+
5. **Teste** suas mudanças:
40+
```sh
41+
lua ./PS/mysandbox/test.lua
42+
```
43+
6. **Commit** suas mudanças:
44+
```sh
45+
git add .
46+
git commit -m "feat: descrição da feature"
47+
```
48+
7. **Push** para seu fork:
49+
```sh
50+
git push origin minha-feature
51+
```
52+
8. Abra um **Pull Request** para a branch `dev`
53+
54+
## Convenções de código
55+
56+
### Estilo
57+
58+
- Indentação com **2 espaços**
59+
- Nomes de variáveis em **camelCase**
60+
- Nomes de classes/módulos em **PascalCase**
61+
- Comentários em português ou inglês
62+
63+
## Estrutura do projeto
64+
65+
```
66+
PudimServerAPIs/
67+
├── PS/ # Código fonte principal
68+
│ ├── init.lua # Módulo principal (PudimServer)
69+
│ ├── http.lua # Parser HTTP e respostas
70+
│ ├── utils.lua # Utilitários e helpers
71+
│ ├── ServerChecks.lua # Validações do servidor
72+
│ └── mysandbox/ # Testes e experimentações
73+
├── rockspecs/ # Specs para LuaRocks
74+
├── README_PT-BR.MD # Documentação em português
75+
└── LICENSE # Licença MIT
76+
```
77+
78+
## Ambiente de desenvolvimento
79+
80+
### Requisitos
81+
82+
- Lua >= 5.4
83+
- LuaRocks
84+
- LuaSocket
85+
- lua-cjson
86+
87+
### Instalação local
88+
89+
```sh
90+
# Instalar dependências
91+
luarocks install luasocket --local
92+
luarocks install lua-cjson --local
93+
94+
# Rodar testes
95+
lua ./PS/mysandbox/test.lua
96+
```
97+
98+
## Dúvidas?
99+
100+
Sinta-se à vontade para abrir uma issue com a tag `question` ou entrar em contato com [Davi](https://github.com/pessoa736).
101+
102+
---
103+
104+
Obrigado por contribuir! 🍮

PS/Cert/init.lua

Lines changed: 0 additions & 59 deletions
This file was deleted.

PS/ServerChecks.lua

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
if not _G.log then _G.log = require("loglua") end
22
local socket = require("socket")
3+
local utils = require("PS.utils")
4+
5+
6+
--- interfaces
7+
8+
---@class PortCheckParams
9+
---@field Address string Endereço a verificar
10+
---@field Port number|string Porta a verificar
11+
12+
local PortCheckParamsInter = utils:createInterface({
13+
Address = "string",
14+
Port = {"number", "string"}
15+
})
16+
17+
18+
---------
19+
--- main
320

421
local ServerChecks = {}
522
ServerChecks.__index = ServerChecks
@@ -10,6 +27,13 @@ ServerChecks.__index = ServerChecks
1027
---@return string erro
1128
function ServerChecks.is_Port_Open(Address, Port)
1229
local CIPO = log.inSection("Check: is Port Open")
30+
31+
utils:verifyTypes(
32+
{Address = Address, Port = Port},
33+
PortCheckParamsInter,
34+
CIPO.error,
35+
true
36+
)
1337

1438
local res = {isOpen = false, msg = ""}
1539

0 commit comments

Comments
 (0)