小编Adr*_*o P的帖子

Golang:IP掩码的位数

在Go中,如何获得IP掩码的位数,如下所示:10.100.20.0 255.255.255.0=> 24bits maks.

检查掩码是低于还是大于特定位数(如果想要阻止大于/ 24的所有地址)将是有帮助的.

ip-address go

6
推荐指数
1
解决办法
3822
查看次数

Apache mod_auth_form如何锁定文件夹

在我看来,我有一个根本的误解,"mod_auth_form"应该如何工作.我参考Apache文档的这个页面:

http://httpd.apache.org/docs/current/mod/mod_auth_form.html
Run Code Online (Sandbox Code Playgroud)

我有一个公用文件夹和一个私人文件夹

我想要实现的是文件夹被锁定.用户需要使用他们的用户名和密码登录才能看到我的受保护文件夹的index.php页面.

这是我的虚拟主机设置:

<VirtualHost  *:80>
    ServerName customform.uwe
    DocumentRoot "/home/uwe/www/protected_custom_form"
    DirectoryIndex index.php
    ErrorLog /var/log/apache2/protected_custom_form.error.log
    CustomLog /var/log/apache2/protected_custom_form.access.log combined

    <Directory "/home/uwe/www/protected_custom_form">
        AllowOverride All
        Allow from All
    </Directory>

    <Directory "/home/uwe/www/protected_custom_form/secret/">

    </Directory>

    <Location /dologin>
        SetHandler form-login-handler
        AuthFormLoginRequiredLocation http://customform.uwe/login.html
        AuthFormProvider file
        AuthUserFile /home/uwe/www/conf/passwd
        AuthType form
        AuthName realm
        Session On
        SessionCookieName session path=/
        SessionCryptoPassphrase secret
    </Location>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这是我的登录表单,它位于我的虚拟服务器的公共文件夹中:

<form method="POST" action="/dologin">
    Username: <input type="text" name="httpd_username" value="" />
    Password: <input type="password" name="httpd_password" value="" />
    <input type="submit" name="login" value="Login" />
    <input type="hidden" name="httpd_location" value="http://customform.uwe/secret/index.php" />
</form>
Run Code Online (Sandbox Code Playgroud)

好的,这是发生的事情 …

apache authentication

5
推荐指数
0
解决办法
4506
查看次数

有没有办法使用 SimpleSchema 和 Typescript 进行 DRY?

您可以使用 Typescript 接口作为数据库的基本架构,但使用 SimpleSchema 和 Collection2 可以真正控制您的数据库架构。

有没有办法更好地将 Typescript接口SimpleSchema集成(为了坚持 DRY 原则)?

在此示例代码中检查Demo 接口架构之间的重复性:

演示.collection.ts

import { MongoObservable } from "meteor-rxjs";
import { Meteor } from 'meteor/meteor';
import SimpleSchema from 'simpl-schema';

export interface Demo {
  name: string;
  age: number;
  location?: string;
  owner?: string;
}

const schema = new SimpleSchema({
  name: String,
  age: SimpleSchema.Integer,
  location: { type: String, optional: true},
  owner:  { type: String, optional: true}
});

let demoCollection = new Mongo.Collection<Demo>('demo-collection');
let demoObservable …
Run Code Online (Sandbox Code Playgroud)

dry mongodb meteor typescript

5
推荐指数
0
解决办法
349
查看次数

标签 统计

apache ×1

authentication ×1

dry ×1

go ×1

ip-address ×1

meteor ×1

mongodb ×1

typescript ×1